AWS ECS
Amazon Elastic Container Service #
AWS ECS (Amazon Elastic Container Service) is a fully managed container orchestration service for deploying, managing, and scaling containerized applications using Docker containers. ECS allows users to easily run containerized applications on a cluster of EC2 instances or with AWS Fargate, handling tasks like scheduling, scaling, and load balancing.
Key concepts #
- Cluster: a logical group of tasks and services and of the capacity that runs them.
- Task definition: the blueprint of an application: the container images (from ECR or Docker Hub), CPU and memory, ports, environment variables, logging and the IAM roles.
- Task: a running instance of a task definition. Service: keeps the desired number of tasks running and can register them in a load balancer.
- Capacity: AWS Fargate (serverless, no instances to manage) or EC2 instances in an Auto Scaling group.
- Networking: the
awsvpcmode gives each task its own network interface in a subnet of a VPC, protected by security groups.
Pricing #
ECS has no additional charge: you pay for the EC2 instances or the Fargate resources that run the tasks.
With Terraform #
The resources are aws_ecs_cluster, aws_ecs_task_definition, aws_ecs_service and aws_ecs_cluster_capacity_providers.
See also: AWS EKS, the managed Kubernetes alternative.
See tutorials: