Quizzes · Compute · Level 0
ECS and Fargate
Run containers on AWS. With Fargate, AWS also runs the servers underneath.
Think of it as: Handing over a packed lunchbox and letting someone else heat it up.
What to know for Level 0
- A running container (or group of containers) is a task. An ECS service keeps the number of tasks you ask for, replacing any that stop.
- With the Fargate launch type, AWS runs and patches the servers; you choose CPU and memory per task. Tasks can run as long as they need.
- With Fargate you pay for the vCPU and memory a task asks for, by the second, from when its image starts downloading until the task stops (one-minute minimum for Linux).
- ECS has two roles: the task role is what your code may do; the task execution role is what ECS needs to start the task (pull the image, send logs).
- Each Fargate task gets its own ENI, with a private IP and its own security groups.
- Container output reaches CloudWatch Logs through the
awslogs log driver, using the task execution role.
What to know for Level 2
- ECS Service Auto Scaling changes the number of tasks with target tracking, for example average CPU at 60% or requests per target from the load balancer.
- Behind an ALB, Fargate tasks register by IP address (target type ip), and the service spreads tasks across AZs.
- With the EC2 launch type you manage the container instances (and can use GPUs, special instances or Spot cheaply); with Fargate you don't manage servers at all.
- Secrets that a task definition references (from Secrets Manager or Parameter Store) are fetched by ECS when the task starts, using the task execution role, and arrive as environment variables. Secrets the code reads itself while running use the task role.
More detail
ECS (Elastic Container Service) starts and watches your containers. A running copy is called a task. With the Fargate launch type there are no servers to manage, and each task gets its own ENI and security group inside your VPC.
Quiz yourself on ECS and Fargate →Study flash cards
← All quizzes