Share this Post

  •    
  •    

Amazon ECS Task Lifecycle

by Jessica Deen

When a task is started, either manually or as part of a service, it can pass through several states before it finishes on its own or is stopped manually. Some tasks are meant to run as batch jobs that naturally progress through from PENDING to RUNNING to STOPPED. Other tasks, which can be part of a service, are meant to continue running indefinitely, or to be scaled up and down as needed.

When task status changes are requested, such as stopping a task or updating the desired count of a service to scale it up or down, the Amazon ECS container agent tracks these changes as the last known status (lastStatus) of the task and the desired status (desiredStatus) of the task. Both the last known status and desired status of a task can be seen either in the console or by describing the task with the API or AWS CLI.

This visual flow chart shows the task lifecycle flow.

Dark Mode - Graphic Download

Light Mode - Graphic Download

Other Visuals

Kubernetes Architecture
Kubernetes Architecture

Amazon Elastic Kubernetes Service (Amazon EKS) is a managed Kubernetes service to run …

Amazon ECS Architecture
Amazon ECS Architecture

Amazon Elastic Container Service (Amazon ECS) is a fully managed container orchestration …

Container Platform Best Practices: Scaling
Container Platform Best Practices: Scaling

Amazon ECS is used to run containerized application workloads of all sizes. This includes both …