Service → Task Definition → Task → Target Group → Load Balancer
coreintermediateA task definition describes what to run — image, CPU, memory, ports, roles, logging. A task is one running copy of it. A service keeps a desired number of tasks running and registers each one in a target group. A load balancer listener forwards matching requests to that target group. Every ECS debugging session is a walk along this chain.
Think of it as
The task definition is a recipe, a task is a dish made from it, the service is the kitchen that keeps N dishes on the pass, and the target group is the pass itself — the list of dishes the waiter is allowed to pick up. A request that fails has stopped somewhere specific along that line.
What we're doing: Diagnose a service that deploys "successfully" but serves 503s.
- 3
- This is the split that confuses people: ECS keeps tasks running, the target group decides whether they receive traffic, and neither knows about the other's definition of healthy.
- 6
- A health check hitting a path that redirects, requires authentication, or does not exist is the single most common cause of permanently unhealthy targets.
- 9
- The deployment itself was never wrong. Nothing in the ECS console was red.
Why this works: ECS reports on tasks and the load balancer reports on targets. A service can be perfectly healthy by one measure and serving nothing by the other, so the debugging habit that pays is walking the whole chain rather than trusting the first green indicator.
Pointing the target group health check at a path that touches the database
Wrong
Better
What you see: A brief database blip marks every task unhealthy at once, the load balancer removes them all, and a recoverable database hiccup becomes a total outage.
Why: The health check decides whether a task receives traffic. Making it depend on a shared downstream turns any downstream problem into a fleet-wide removal, and the tasks were capable of serving cached or degraded responses the whole time.
- Load balancer — security group must allow the client
- leads to Listener + rule (arrives at)
- Listener + rule — host / path / header match
- leads to Target group (forwards to)
- Target group — health check decides membership
- leads to Task (if healthy)
- Task — its security group must allow the load balancer
- leads to Container (container port)
- Container — listening on the mapped port
Walking the chain when requests fail
Together
Remember: Task definition (versioned recipe) → task (one copy) → service (keeps N and registers them) → target group (health check decides traffic) → listener rule → load balancer. "Tasks running" and "targets healthy" are different facts; debug by walking the chain.
See also: deployment health and rollback · ecs core vocabulary · listeners rules and target groups

