サービス · Containers · CLF-C02 の発展
Amazon Elastic Container Service (Amazon ECS)
Choose Fargate or EC2, pick the right IAM role, and scale services behind a load balancer.
このレッスンはまだ翻訳されていないため、英語で表示しています。
クラウドプラクティショナーで学んだこと
- Managed orchestration. A task definition is the blueprint, a task runs it, a service keeps tasks running.
- Tasks run on Fargate or on EC2 instances.
- Works with Amazon ECR and Elastic Load Balancing.
- 1A user sends a request.
- 2The load balancer forwards it to a task in the target group.
- 3ECS pulls the image from Amazon ECR when a task starts, using the task execution role.
Servers
- Fargate
- None to manage
- ECS on EC2
- You run the instances
Price
- Fargate
- Task vCPU and memory, per second
- ECS on EC2
- Per instance. Savings Plans, Spot
Hardware
- Fargate
- No GPUs. Up to 32 vCPU, 244 GB
- ECS on EC2
- GPUs and any instance type
Scaling
- Fargate
- Task count
- ECS on EC2
- Task count and instance count
| Compare | Fargate | ECS on EC2 |
|---|---|---|
| Servers | None to manage | You run the instances |
| Price | Task vCPU and memory, per second | Per instance. Savings Plans, Spot |
| Hardware | No GPUs. Up to 32 vCPU, 244 GB | GPUs and any instance type |
| Scaling | Task count | Task count and instance count |
1 / 2
Servers
- Fargate
- None to manage
- ECS on EC2
- You run the instances
Price
- Fargate
- Task vCPU and memory, per second
- ECS on EC2
- Per instance. Savings Plans, Spot
Hardware
- Fargate
- No GPUs. Up to 32 vCPU, 244 GB
- ECS on EC2
- GPUs and any instance type
| Compare | Fargate | ECS on EC2 |
|---|---|---|
| Servers | None to manage | You run the instances |
| Price | Task vCPU and memory, per second | Per instance. Savings Plans, Spot |
| Hardware | No GPUs. Up to 32 vCPU, 244 GB | GPUs and any instance type |
2 / 2
Scaling
- Fargate
- Task count
- ECS on EC2
- Task count and instance count
| Compare | Fargate | ECS on EC2 |
|---|---|---|
| Scaling | Task count | Task count and instance count |
概要
With the Fargate launch type, you manage no servers and pay for task CPU and memory. With the EC2 launch type, you run the instances: more control, GPUs, and a lower price at steady high use. A capacity provider can mix them, for example a base of Fargate tasks plus extra tasks on Fargate Spot. ECS Anywhere runs tasks on your own servers, managed from ECS in AWS.
概要
ECS uses two roles. The task execution role lets ECS itself pull images from Amazon ECR, write logs and read secrets. The task role gives the code in the container its own permissions, such as reading an S3 bucket. If the app is denied, fix the task role. If the image cannot be pulled, fix the execution role.
Service auto scaling changes the number of tasks by target tracking, step or scheduled scaling. Each task registers with a target group of an Application Load Balancer. With awsvpc networking, each task has its own network interface and security group. With dynamic port mapping, several tasks of a service can share one EC2 instance.
覚えること
- Fargate: no servers. EC2: control over nodes, GPUs, Spot.
- Task execution role: pull images, write logs. Task role: permissions for your code.
- Service auto scaling changes the task count. Capacity providers scale the EC2 nodes.
- Tasks register in an ALB target group as they start.
覚えること
- awsvpc mode: each task has its own network interface and security group.
- ECS Anywhere: run tasks on your own servers.
試験では
- “Container cannot read an S3 bucket” points to the task role.
- “Container image cannot be pulled” points to the task execution role.
- “Run containers on premises, managed from ECS” points to ECS Anywhere.
- “No servers, containers behind a load balancer” points to ECS on Fargate.
混同しやすいもの
Amazon Elastic Kubernetes Service (Amazon EKS)Choose nodes, give pods their own IAM roles, expose them with a load balancer, and weigh ECS against EKS.
AWS FargateTask sizes, storage, Fargate Spot, and when Fargate beats EC2 nodes.
Amazon Elastic Container Registry (Amazon ECR)A private image registry with scanning and replication.