---
title: "CloudFormation ECS service did not stabilize: find the real failure | Proofline"
description: "When a stack update waits on an AWS::ECS::Service and then fails, the stack event only says the service never settled."
url: https://proofline.sh/learn/cloudformation-ecs-service-did-not-stabilize/
---

[Learning center](/learn/)

# CloudFormation ECS service did not stabilize: find the real failure

When a stack update waits on an AWS::ECS::Service and then fails, the stack event only says the service never settled. Find the first failed resource event and how long the service resource was in progress, then read the ECS deployment and its stopped tasks, which hold the cause.

Deployment failures The Proofline team November 22, 2026 7 min read

## What CloudFormation waits for

CloudFormation does not mark an ECS service update complete when ECS accepts the new configuration. It polls the service until it reaches the state the template describes and only then reports the resource done. A service whose new tasks cannot launch or stay running holds the stack in `UPDATE_IN_PROGRESS` for hours. CloudFormation then fails the resource with a reason saying the service did not stabilize, and the stack starts to roll back. [Service fails to stabilize in CloudFormation](https://repost.aws/knowledge-center/cloudformation-ecs-service-stabilize) · [ECS service stuck in an update](https://repost.aws/knowledge-center/ecs-service-stuck-update-status)

That reason names the resource and leaves the cause in ECS. Three nearby situations produce a failed ECS service in the stack events, and they need different fixes:

-   **The new tasks start and then stop.** The revision cannot start, its process exits, or it fails a health check. The new ECS deployment has stopped tasks with stop codes.
-   **ECS never places the new tasks.** No capacity or placement constraint fits them. The new deployment has no stopped tasks, and the service events name what failed.
-   **The service is not the first failure.** Another resource in the same update failed first and CloudFormation cancelled the rest, or ECS rejected the service update request outright. Either way the stack spent little or no time waiting on the service.

## Read the stack events in time order

Use a read-only profile and replace the uppercase placeholders. Start with the stack itself: its status, the role CloudFormation used and the latest operations.

```
aws cloudformation describe-stacks \
  --profile PROFILE --region REGION --stack-name STACK \
  --query 'Stacks[0].{status:StackStatus,reason:StackStatusReason,role:RoleARN,operations:LastOperations}' \
  --output json --no-cli-pager
```

`describe-stack-events` returns events newest first and covers the stack's whole history. This query keeps the stack's own status changes and every failed resource event, then reverses them into time order, so you can see where the update began and which resource failed first. [Stack events](https://docs.aws.amazon.com/cli/latest/reference/cloudformation/describe-stack-events.html) · [StackEvent fields](https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_StackEvent.html)

```
aws cloudformation describe-stack-events \
  --profile PROFILE --region REGION --stack-name STACK --max-items 300 \
  --query 'reverse(StackEvents[?ResourceType==`"AWS::CloudFormation::Stack"` || ends_with(ResourceStatus, `"FAILED"`)])[].[Timestamp,LogicalResourceId,ResourceType,ResourceStatus,ResourceStatusReason]' \
  --output json --no-cli-pager
```

Find the stack's last `UPDATE_IN_PROGRESS` event and read the first failure after it. Then pull the ECS service's own events for the same update to measure how long it was in progress:

```
aws cloudformation describe-stack-events \
  --profile PROFILE --region REGION --stack-name STACK --max-items 300 \
  --query 'reverse(StackEvents[?LogicalResourceId==`"SERVICE_LOGICAL_ID"`])[].[Timestamp,ResourceStatus,ResourceStatusReason]' \
  --output json --no-cli-pager
```

Newer CLI versions also offer `describe-events`, which takes an operation ID from `LastOperations` and a filter that returns only failed events for that operation. [DescribeEvents](https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_DescribeEvents.html)

| What the events show | What it means | Next read |
| --- | --- | --- |
| Another resource failed first; the service's later failure says its update was cancelled | The service did not fail on its own | That first resource's `ResourceStatusReason` |
| The service went from `UPDATE_IN_PROGRESS` to `UPDATE_FAILED` within seconds or minutes, with a reason carrying an ECS error | ECS rejected the request; CloudFormation never waited on tasks | The template property the error names |
| The service stayed `UPDATE_IN_PROGRESS` for hours, then failed with a reason about stabilization | ECS accepted the update and the new deployment never reached steady state | The ECS deployment, below |

A resource can also be `UPDATE_FAILED` because the update was cancelled; the `ContinueUpdateRollback` API reference uses that case as an example. Do not chase a cancelled resource's reason. [ContinueUpdateRollback](https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ContinueUpdateRollback.html)

## Then read the ECS deployment

The service's physical ID comes from the stack resource. Pass it to `describe-services` with the cluster named in the template's `Cluster` property. [Stack resources](https://docs.aws.amazon.com/cli/latest/reference/cloudformation/describe-stack-resources.html)

```
aws cloudformation describe-stack-resources \
  --profile PROFILE --region REGION --stack-name STACK --logical-resource-id SERVICE_LOGICAL_ID \
  --query 'StackResources[0].{physical:PhysicalResourceId,status:ResourceStatus,reason:ResourceStatusReason}' \
  --output json --no-cli-pager

aws ecs describe-services \
  --profile PROFILE --region REGION --cluster CLUSTER --services SERVICE_PHYSICAL_ID \
  --query 'services[0].{deployments:deployments[].{id:id,status:status,definition:taskDefinition,desired:desiredCount,running:runningCount,pending:pendingCount,failed:failedTasks,rollout:rolloutState,reason:rolloutStateReason,created:createdAt},events:events[:10].[createdAt,message]}' \
  --output json --no-cli-pager
```

Pick the deployment whose `definition` is the new revision. Once a rollback has begun, a newer deployment for the previous revision can be `PRIMARY`. `failedTasks` counts consecutive tasks that could not launch, never reached `RUNNING`, or failed a health check and were stopped; it resets once the deployment has a running task. `rolloutState` is `FAILED` when the deployment circuit breaker is on and the service could not reach steady state, and a failed deployment launches no new tasks. [Deployment fields](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_Deployment.html) · [Deployment circuit breaker](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-circuit-breaker.html)

`list-service-deployments` and `describe-service-deployments` give the same rollout a status such as `ROLLBACK_SUCCESSFUL` or `ROLLBACK_FAILED` and a `statusReason`, which says, for example, that the circuit breaker detected a failure. [ServiceDeployment fields](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ServiceDeployment.html)

Then list the stopped tasks and keep those whose `startedBy` matches that deployment's ID:

```
aws ecs list-tasks \
  --profile PROFILE --region REGION --cluster CLUSTER \
  --service-name SERVICE --desired-status STOPPED \
  --query 'taskArns' --output json --no-cli-pager

aws ecs describe-tasks \
  --profile PROFILE --region REGION --cluster CLUSTER --tasks TASK_ARN_1 TASK_ARN_2 \
  --query 'tasks[].{deployment:startedBy,definition:taskDefinitionArn,started:startedAt,stopped:stoppedAt,code:stopCode,reason:stoppedReason}' \
  --output json --no-cli-pager
```

If the new deployment has stopped tasks, group them by stop code and follow [the stop code guide](/learn/ecs-task-stop-codes/) for each group; the fix belongs in the revision or its configuration. If it has none and `running` and `pending` stay at 0, read the service events for the placement constraint that failed; the fix is capacity, and the revision may be fine.

## An illustrative stack update

This fixture is fictional. Stack `orders-prod` updates `OrdersService` from task definition `orders:57` to `orders:58`, and in the same update changes the IAM role `OrdersTaskRole`.

In the first outcome, the service is the first and only failure:

| Time | Record | Value |
| --- | --- | --- |
| 09:58 | Stack | `UPDATE_IN_PROGRESS` |
| 09:58 | `OrdersService` | `UPDATE_IN_PROGRESS` |
| 12:39 | ECS deployment `ecs-svc/2211` (`orders:58`) | Latest stopped tasks show `TaskFailedToStart`; the reason names a log group that does not exist |
| 12:41 | `OrdersService` | `UPDATE_FAILED`; the reason says the service did not stabilize |
| 12:41 | Stack | `UPDATE_ROLLBACK_IN_PROGRESS` |

Two hours and forty minutes in progress says ECS accepted the update and kept trying. The stopped tasks say the revision never started, so the fix is the log configuration in `orders:58`.

In the second outcome, `OrdersTaskRole` fails at 09:58 with a reason naming an IAM error, and `OrdersService` fails a few seconds later as cancelled. ECS has no `orders:58` deployment, or one that CloudFormation is already rolling back. Reading ECS stopped tasks here would find nothing related; the IAM change is the failure.

## Where this read misleads

The wait outlasts the evidence. ECS keeps stopped tasks for at least an hour and returns only the 100 most recent service events, so after a multi-hour wait the first failures are gone. Without the circuit breaker the scheduler keeps launching tasks, and recent stopped tasks usually show the same failure. With the circuit breaker, a `FAILED` deployment stops launching, so its stopped tasks age out: read them early or keep ECS task state change events. Compare with the rest of the [signature table](/learn/aws-deployment-failure-signatures/). [Stopped task errors](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/stopped-task-errors.html) · [Service fields](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_Service.html)

The rollback waits too. CloudFormation returns the service to its previous configuration and waits for that to stabilize. If the previous revision cannot run either, because the capacity is gone or something it depends on was deleted, the stack can end in `UPDATE_ROLLBACK_FAILED`. That state has its own read: [find the resource that can't go back](/learn/cloudformation-update-rollback-failed/). [ECS service stuck in an update](https://repost.aws/knowledge-center/ecs-service-stuck-update-status)

Cancelling the update is a change, not a read. `cancel-update-stack` works only in `UPDATE_IN_PROGRESS` and rolls the stack back to its previous configuration, which starts the same wait on the previous revision. [CancelUpdateStack](https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CancelUpdateStack.html)

```
# Change: rolls the stack back to its previous configuration.
aws cloudformation cancel-update-stack \
  --profile PROFILE --region REGION --stack-name STACK --no-cli-pager
```

Whether the circuit breaker should own the service rollback, and why a deployment stays in progress, are separate questions. This guide only places the failure.

## Questions

### Why does my CloudFormation stack stay in UPDATE\_IN\_PROGRESS on an ECS service?

CloudFormation waits until the ECS service reaches the state the template describes. If the new tasks keep failing or are never placed, the service never gets there, and the stack waits for hours before failing the resource.

### How do I find the cause of an ECS service that did not stabilize?

Confirm from the stack events that the service was the first failure and stayed in progress for a long time. Then read the ECS deployment for the new revision and its stopped tasks, grouped by stop code; if there are no stopped tasks, read the service events for placement.

### Should I cancel a stack update that is waiting on an ECS service?

Cancelling rolls the stack back to its previous configuration, and CloudFormation then waits for the previous revision to stabilize. Read the stopped tasks first so you know whether that revision can still run.

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [Which ECS task stops came from your deployment? Read the stop code](/learn/ecs-task-stop-codes/)
    
    Deployment failures The Proofline team November 22, 2026 6 min read
    
-   ### [UPDATE\_ROLLBACK\_FAILED in CloudFormation: find what can't roll back](/learn/cloudformation-update-rollback-failed/)
    
    Deployment failures The Proofline team November 22, 2026 6 min read
