AWS ECS Tasks
Define ECS tasks, deploy container images from ECR, and run services with desired counts, load balancers, and auto scaling.
ECS runs containers by combining task definitions with services and clusters. A task definition is the blueprint. It names the container image, CPU and memory requirements, port mappings, environment variables, logging configuration, and IAM roles. If you have used Docker Compose, think of the task definition as a cloud-aware runtime description with AWS-specific controls.
Services sit on top of tasks and keep the desired number of copies running. They can register targets behind an Application Load Balancer, replace failed tasks automatically, and scale out when metrics or schedules require more capacity. This is the layer that turns a container image into a continuously running application.
| ECS concept | Role |
|---|---|
| Task definition | Blueprint for one or more containers |
| Task | A running copy of that blueprint |
| Service | Maintains desired count and deployment behavior |
| Cluster | Logical place where tasks run |
Deployments usually start in ECR, AWS’s container registry. After you push an image, ECS can pull that image into a task definition revision. Updating a service to the new revision triggers a rolling deployment. That model makes image tagging, version control, and rollback strategy important parts of the container workflow.
Auto scaling matters when container traffic changes over time. Desired count can remain fixed for small internal tools, but customer-facing services often scale on CPU, memory, or request count. The more stateless the application is, the easier ECS deployments and scaling become.
Pair this lesson with AWS ECS and EKS to decide whether ECS fits your team better than Kubernetes on EKS.
aws ecr describe-repositories
aws ecs register-task-definition --cli-input-json file://task-definition.json
aws ecs update-service --cluster app-cluster --service web --task-definition web:2
Operational note
Container platforms are easiest to run when images are immutable, deployments are versioned, and logs and health checks are built into the application from the beginning. Whether you pick ECS or EKS, a predictable image build pipeline and a clean rollback story are more important than the orchestrator brand name. Shared standards like this make future environments easier to launch, review, and support.
Task definitions
What does an ECS task definition primarily describe?
Services
What is a main job of an ECS service?