1.Service → Task Definition → Task → Target Group → Load Balancer
A 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.
Key features
- A task definition is versioned: each change creates a new revision, and a service points at a specific revision
- A service maintains the desired count, replaces failed tasks, and registers and deregisters tasks with its target group automatically
- The target group's health check decides whether a task receives traffic; the container health check (if defined) decides whether ECS considers the container healthy
- A listener rule on the load balancer selects a target group by host, path, or header — one load balancer can front many services
- ECS resolves the image tag in the task definition to a digest and uses that digest for every other task in the service, so all tasks run identical images
- If digest resolution fails three or more times the deployment continues without it, and with the circuit breaker enabled the deployment is failed and rolled back; on Fargate each task gets its own elastic network interface and security group
Walking the chain when requests fail
- 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
Signature
task definition (revision) → task → service (desired count) → target group (health) → listener rule → ALB
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.