Containers
Amazon ECS
Fully managed container orchestration service for deploying, managing, and scaling containerized applications without operating a control plane. Containers can run on Amazon EC2 instances (managed by you or by AWS with Amazon ECS Managed Instances), on AWS Fargate (no servers to manage), or on your own servers with Amazon ECS Anywhere.
Exam phrases that point here
«orchestrate containers without installing or operating your own control plane»
Amazon ECS is the AWS managed container orchestrator: it decides where tasks run, maintains the desired count, replaces the ones that fail, and integrates with Elastic Load Balancing, IAM, and the VPC.
When not: If the scenario requires Kubernetes (Kubernetes manifests, tooling, or portability), the answer is Amazon EKS. If there are no containers but short pieces of code that react to events, think of AWS Lambda.
«run containers on Amazon ECS without managing EC2 instances»
With Fargate as the capacity, ECS launches each task without any instances to choose, patch, or scale; you only define the task's CPU and memory.
When not: If you need a GPU, your own AMI, privileged containers, or a specific instance type, use ECS on EC2 instances (or ECS Managed Instances, where AWS manages those instances).
«give each container only the permissions it needs to access other AWS services»
The task's IAM role provides temporary credentials to the containers in that task, so each service has its own least-privilege role without relying on the instance role.
When not: The permissions to pull the image from ECR, send logs to CloudWatch, or read secrets referenced in the task definition go in the task execution role, not in the task role.
«adjust the number of tasks based on CPU, requests, or queued messages»
ECS publishes CPU and memory metrics for each service, and Application Auto Scaling raises or lowers the number of tasks based on them or on custom CloudWatch metrics, such as the messages in a queue.
When not: With EC2 instances you also have to scale the instances (with an Auto Scaling group capacity provider); with Fargate you don't. If what needs to scale isn't containers, use EC2 Auto Scaling or Lambda.
«several container services behind a single load balancer, routed by path»
ECS registers and deregisters tasks in the target group automatically; with dynamic ports and Application Load Balancer path-based rules, several services share one load balancer.
When not: If you need TCP/UDP traffic with very low latency, think of Network Load Balancer. If only internal services talk to each other, ECS Service Connect provides logical names without a load balancer.
Often paired with
- Amazon ECR
- AWS Fargate
- Elastic Load Balancing (ELB)
- Amazon EC2