ExitAmazon ECS: service health and task replacement1 / 9
Explanation

Replacement is a scheduling loop, not an unlimited retry loop

How the ECS service scheduler preserves healthy task capacity through startup failures, rolling replacements, and deployment rollback. · advanced

An ECS service scheduler maintains a specified number of simultaneous instances of a task definition. When a task fails or stops, the scheduler launches a replacement. Task placement strategies and constraints customize how it places and terminates tasks.

Replacement also responds to container health checks and load balancer target group health checks: a task can require replacement because it is unhealthy, not just because it stopped. Unhealthy-task replacement depends on the service's maximumPercent and desiredCount; detecting failure does not remove scheduling limits.

Startup failure has a separate scheduling response. If a task stops before reaching RUNNING, the scheduler slows subsequent launch attempts and emits a service event. After the service is updated, normal scheduling resumes. Distinguish this restart throttling from declaring a deployment failed.