Why is my ECS deployment stuck in progress, and how do you fix it?
By the Keel team · Last checked · 7 min read
Short answer
An ECS deployment sits in progress when new tasks never become healthy or never start at all, so the old ones are not replaced. Read the service events first, then the stopped reason on the failed tasks: together they name the cause, which is usually a health check, capacity, an image pull or a task that exits on start. If the new version cannot work, stop the deployment and roll back to the previous revision.
What do the ECS service events tell you first?
Read the service events first, because the scheduler usually names the problem in plain words.
The service events are the scheduler's running commentary on your deployment, and they usually name the problem in plain words. Read them before you touch anything. In the console, open the service and choose the Events tab. On the command line, the same events appear in the output of describe-services.
aws ecs describe-services \
--cluster my-cluster \
--services my-serviceIn the output, look at the deployments array for the rolloutState of each deployment, and at events for the newest messages. A line saying the service has reached a steady state means the service is healthy and running its desired number of tasks. Anything else points at one of the causes below.
Why are ECS tasks stopped, and where do you find the reason?
Every stopped task records its reason, so describe it and read the stop code.
A task stops because something told it to or because it failed, and ECS records why on the task itself. List the stopped tasks, then describe one and read stopCode, stoppedReason and the reason on each container.
aws ecs list-tasks \
--cluster my-cluster \
--desired-status STOPPED
aws ecs describe-tasks \
--cluster my-cluster \
--tasks <task-arn>Do this soon after the failure. AWS says stopped tasks stay visible in the console for only an hour, and its page does not state how long the API keeps them, so copy the reason into your incident notes while you can still see it.
AWS groups stopped task errors by category, such as ResourceInitializationError and CannotPullContainer. The category tells you which family of problem you have before you read the detail.
What are the usual causes of a stuck deployment?
Almost every stuck deployment is a health check, capacity, a port, an image pull or a crash.
Nearly every stuck deployment is one of five things: a failing health check, not enough capacity, a port conflict, an image that will not pull, or a container that exits as soon as it starts. The service event or the stopped reason will match one of them.
| What you see | Likely cause | Where to look |
|---|---|---|
| Event says a task is unhealthy in the load balancer | The health check path or port is wrong, or the app starts slowly | Target group health, task logs, grace period |
| Event says no container instance met all of its requirements | Not enough CPU, memory or network interfaces, or no instances | Cluster capacity and the task size |
| Event says the instance is already using a port | Fixed host port with too few instances | Port mappings in the task definition |
| Stopped category is CannotPullContainer | The image or tag cannot be found or fetched | Image name, registry permissions and network route |
| Stopped category is ResourceInitializationError | The task could not set up something it needs before starting | The stopped reason text and the task role settings |
| Task starts, then exits | The container crashes, often on a bad setting or missing secret | Container logs and the container exit reason |
Port conflicts and capacity limits matter mostly on EC2. On Fargate, the usual suspects are health checks, image pulls and startup crashes, plus account quotas on tasks and vCPUs, which AWS lists among the service event messages.
Is a failing health check the cause?
Often yes, either because the new version is broken or because it is slow to start.
Often, yes. If the event says a task is unhealthy in the load balancer because it failed the unhealthy threshold of health checks, ECS will stop that task and start another, and the deployment never settles. The new version may be broken, or it may simply be slow to start.
For slow starters, set a health check grace period. AWS describes it as the time the scheduler ignores unhealthy load balancer and container health checks after a task first starts, and the default is 0. Changing it does not start a new deployment on its own.
A health check that is too shallow causes the opposite problem, so read what a deployment health check should test before you loosen one.
Why does an ECS task keep stopping and restarting?
The task is failing the same way each time, and the service keeps replacing it.
A task that keeps stopping and restarting is failing the same way each time, and a service will keep replacing it. Compare the stopped reasons across several tasks. If they are identical, you have one cause, such as a crash on start, a missing environment value or a failing health check.
Check the container logs for the last lines before the exit, then confirm the task definition revision is the one you intended. A task that starts and then exits is a different problem from one that never starts, because the first points at your application and the second at the platform around it.
If a task fails to start with a resource initialisation error, the stopped reason text is the quickest guide. Read it in full rather than relying on the category.
Does the deployment circuit breaker stop a stuck deployment?
Only if it is switched on, and it can only roll back to a completed deployment.
It can, but only if it is switched on and only for services using the rolling update controller. According to AWS, the circuit breaker marks a deployment as failed when the failure count reaches a threshold, and a failed deployment launches no new tasks.
A task that never reaches RUNNING counts as a failure, as does one that fails a load balancer, Cloud Map or container health check once it is running. By default the threshold is 50 per cent of the desired count, with a minimum of 3 and a maximum of 200, and the count resets when a task becomes healthy.
With rollback enabled, it returns the service to the most recent completed deployment. AWS notes that if there is no completed deployment to return to, it cannot roll back and the deployment stalls without launching tasks. AWS recommends an EventBridge rule for a deployment failed event, so a person is told. Automating the response is covered in ECS automatic rollback with GitHub Actions.
Do ECS tasks have a time limit, and why is my deployment taking so long?
A slow deployment usually means tasks are being retried, not that ECS timed it out.
I found no documented time limit on how long a service task may run, so a deployment is slow because tasks are being retried, not because ECS timed it out. Check the current docs for your launch type before relying on this. The number that does matter is stopTimeout, the wait before a container is forcefully killed.
A deployment that takes too long is usually replacing tasks slowly: a long grace period, a long shutdown, or repeated failures. The minimumHealthyPercent and maximumPercent settings matter too. AWS lists a service event for deployments that cannot stop or start a task because those settings leave no room, so give the service at least one task of headroom.
How do you stop or roll back a stuck deployment safely?
Roll back to the previous service revision, after saving the events and stopped reasons.
Roll the deployment back to the previous service revision. AWS documents a Roll back option in the console and a stop-service-deployment command, and says you can use it even if you did not configure rollback on the service.
aws ecs list-service-deployments \
--cluster my-cluster \
--service my-service
aws ecs stop-service-deployment \
--service-deployment-arn <service-deployment-arn> \
--stop-type ROLLBACKAs a fallback, point the service back at an earlier task definition revision with update-service. The UpdateService reference accepts a family:revision value, and --force-new-deployment starts a deployment with no other changes.
aws ecs update-service \
--cluster my-cluster \
--service my-service \
--task-definition my-family:12Before you roll back, capture the events and stopped reasons. A rollback restores the old code, not the old database: if the release included a migration, read rolling back ECS after a database migration first.
How do you stop deployments getting stuck again?
Make a bad release fail fast and revert itself, so nobody has to watch it.
Make a bad release fail fast and revert itself, so nobody has to watch it. Turn on the circuit breaker with rollback, set a realistic grace period, and make the health check test something that matters. Whether a rolling or blue/green strategy suits you is a separate choice, set out in blue/green or rolling on ECS.
The wider habit is shipping small changes with a tested way back, which shipping on AWS without breaking production covers.
Could your next stuck ECS deployment fix itself?
Tick each item that is true today.
- The deployment circuit breaker is on with rollback enabled.
- A health check grace period suits how long the app takes to start.
- The load balancer health check tests something that matters.
- Someone is alerted when a deployment fails, not only when users complain.
- You know how to read service events and stopped task reasons.
- You have rolled back a deployment in practice, not just in theory.
Decision point: Five or six ticks: a bad release will mostly revert itself. Three or fewer: a stuck deployment will need a person and a guess.
Sources
- AWS docs, Amazon ECS deployment circuit breaker (checked November 2026)
- AWS docs, Amazon ECS service event messages (checked November 2026)
- AWS docs, Amazon ECS stopped task error messages (checked November 2026)
- AWS docs, Stopping Amazon ECS service deployments (checked November 2026)
- AWS API reference, UpdateService (checked November 2026)
Keep reading
Keel is an AWS release and recovery operations service for SaaS teams of 3 to 15 developers, provided by Bargainn Services Ltd, a UK company registered at Companies House (16497746). Registered office: 3rd Floor, 86-90 Paul Street, London, EC2A 4NE, United Kingdom.