ECS Operations
Explore ECS operations to understand how to maintain service stability by managing desired and running task counts. Learn to diagnose task failures by analyzing stop reasons, exit codes, and logs. Understand practical triage methods to identify root causes and apply safe remediations. Discover how to use ECS native signals to set alarms that prevent recurrent task failures and ensure consistent service availability.
An ECS service is defined by a desired count, and the scheduler's job is to keep the running count converged with it. When desired equals running and pending is 0, the service is at steady state. Nothing needs to happen, and replacements occur only during deployments or scale changes.
That steady state is the baseline everything gets compared against. If desired count stays constant but ECS keeps launching replacement tasks, the service isn't at steady state. It's stuck in a loop, where each launch succeeds enough to create a task, but something prevents that task from staying healthy long enough for the count to converge.
The first pass at diagnosing that loop is treated as evidence collection, not remediation. The minimum set that shortens the path to root cause is the service events timeline, the task stoppedReason, the container exitCode, and the CloudWatch Logs link if the task exposes one.
The diagram below maps the numbers and the replacement attempt to what a flapping ... ...