ECS Core Vocabulary
coreintermediateA task definition is the blueprint for a container app. A task is one running instance of that blueprint. A service keeps a desired number of tasks running long-term, replacing any that die. A cluster is the logical grouping all of this runs inside. A capacity provider decides what infrastructure (EC2 or Fargate) actually runs the tasks.
Think of it as
A task definition is a recipe. A task is one cooked meal made from that recipe. A service is a standing order to always have N meals ready, replacing any that get eaten or spoiled. The cluster is the kitchen; the capacity provider decides whether the kitchen uses your own stove (EC2) or a caterer's (Fargate).
What we're doing: See how a task definition, a service, and a cluster relate in one deployment.
- 1
- Registering a task definition creates a new revision — "web:3" means the third registered revision of the "web" family.
- 2
- The service targets a specific cluster and pins to task definition revision 3.
- 3
- desired-count 3 tells the service scheduler to keep exactly three healthy tasks running at all times.
Why this works: A task definition alone does nothing — it is inert until a task or service runs it. A service is what turns "run this blueprint" into "always have three of these running," including replacing any that crash.
Running a long-lived app as a bare task instead of a service
Wrong
Better
What you see: The application stops permanently the moment the task crashes or the underlying instance is replaced — nothing restarts it.
Why: run-task starts a task once with no ongoing supervision. A service is the layer that watches desired count and relaunches replacements — without it, ECS treats the task like the batch job it was designed for.
- Cluster — the logical grouping everything runs inside
- Service — keeps N tasks running, replaces failures
- Task — one running instance of a task definition
- Task definition — the versioned blueprint — image, CPU/memory, roles
Remember: Task definition = blueprint. Task = one running instance. Service = keeps N tasks running, replaces failures. Cluster = the logical grouping. Capacity provider = EC2 or Fargate.
See also: ecs on ec2 vs fargate · deployment strategies

