AWSMid

ECS task stopped: how to find the reason

If an ECS task starts and then disappears, read its stopCode and stoppedReason with describe-tasks, then follow the matching AWS error category.

What you see

  • The task shows PENDING and then disappears
  • A service keeps stopping and replacing tasks

What it means

A task can stop because of an application or configuration error. For tasks created by a service, ECS publishes what it does in the service events, including stopping and replacing a task whose containers stopped or failed too many load balancer health checks.

Stopped tasks appear in the console for only 1 hour, so look quickly.

How to confirm the cause

  1. 1
    List stopped tasks
    aws ecs list-tasks --cluster CLUSTER_NAME --desired-status STOPPED --region REGION
  2. 2
    Describe one
    aws ecs describe-tasks --cluster CLUSTER_NAME --tasks TASK_ARN --region REGION

    Read stopCode (for example ResourceInitializationError), stoppedReason, and reason inside each container.

Causes and fixes

  • A known error category

    HOW TO TELL
    stopCode names one of: TaskFailedToStart, ResourceInitializationError, ResourceNotFoundException, SpotInterruptionError, InternalError, OutOfMemoryError, ContainerRuntimeError, ContainerRuntimeTimeoutError, CannotStartContainerError, CannotStopContainerError, CannotInspectContainerError, CannotCreateVolumeError, CannotPullContainer.
    FIX
    Open the AWS troubleshooting page for that category (linked below) and follow it. Each category has its own page.

How to stop it coming back

  • Send container logs to CloudWatch Logs so a stopped task's output survives.
  • Alert on service events that show repeated task replacement.

Keep going

Sources

AWS documentation (docs.aws.amazon.com), read 18 Nov 2026.

Search

Search cheat sheets and projects