概念 · CLF-C02 の発展
When and how to containerize
When containers beat virtual machines and Lambda, how to move a legacy app into one, and how to choose ECS, EKS and Fargate.
このレッスンはまだ翻訳されていないため、英語で表示しています。
クラウドプラクティショナーで学んだこと
- A container image packs code and everything it needs, so it runs the same everywhere.
- Amazon ECR stores images. Amazon ECS or Amazon EKS orchestrates them.
- Containers run on AWS Fargate (no servers to manage) or on EC2 instances.
Sessions
- Before
- Server memory
- In the container
- ElastiCache or DynamoDB
Uploaded files
- Before
- Local disk
- In the container
- S3 or EFS
Settings
- Before
- Config file on the server
- In the container
- Environment variables, Secrets Manager
Logs
- Before
- Files on disk
- In the container
- Standard output, CloudWatch Logs
Install
- Before
- By hand on each server
- In the container
- Image built once, stored in ECR
| Concern | Before | In the container |
|---|---|---|
| Sessions | Server memory | ElastiCache or DynamoDB |
| Uploaded files | Local disk | S3 or EFS |
| Settings | Config file on the server | Environment variables, Secrets Manager |
| Logs | Files on disk | Standard output, CloudWatch Logs |
| Install | By hand on each server | Image built once, stored in ECR |
1 / 2
Sessions
- Before
- Server memory
- In the container
- ElastiCache or DynamoDB
Uploaded files
- Before
- Local disk
- In the container
- S3 or EFS
Settings
- Before
- Config file on the server
- In the container
- Environment variables, Secrets Manager
| Concern | Before | In the container |
|---|---|---|
| Sessions | Server memory | ElastiCache or DynamoDB |
| Uploaded files | Local disk | S3 or EFS |
| Settings | Config file on the server | Environment variables, Secrets Manager |
2 / 2
Logs
- Before
- Files on disk
- In the container
- Standard output, CloudWatch Logs
Install
- Before
- By hand on each server
- In the container
- Image built once, stored in ECR
| Concern | Before | In the container |
|---|---|---|
| Logs | Files on disk | Standard output, CloudWatch Logs |
| Install | By hand on each server | Image built once, stored in ECR |
概要
Choose containers for many small services, fast start and dense packing, the same package from laptop to production, and code that does not fit Lambda: runs longer than 30 minutes (older exams say 15), a custom runtime or a long-lived process. Choose virtual machines (EC2) when the app needs full control of the operating system or kernel, or has licensing tied to a server. Choose Lambda for short, event-driven code with spiky traffic.
概要
To move a legacy app into a container, first make it stateless: keep sessions, uploads and files outside the container, in ElastiCache, S3, EFS or a database. Move settings to environment variables or AWS Secrets Manager, not config files baked into the image. Write logs to standard output so the platform collects them. Build the image, store it in Amazon ECR and run it as an ECS service or EKS deployment behind a load balancer. Data written inside a container is lost when it stops.
概要
ECS is the AWS-native orchestrator with the simplest setup and deep IAM integration. EKS runs Kubernetes: choose it when the team already uses Kubernetes, wants portability, or needs the Kubernetes tools. Fargate removes the servers for either. Choose EC2 capacity when you need GPUs, special instance types, or the lowest cost at a steady high load.
覚えること
- Containers fit microservices, fast scaling, and long-running or custom-runtime code.
- Make the app stateless before containerizing. Data inside a container is lost when it stops.
- Settings in environment variables or Secrets Manager. Logs to standard output.
- Image in ECR, then run on ECS or EKS.
覚えること
- ECS: simplest. EKS: Kubernetes. Fargate: no servers for either. EC2: GPUs and cost control.
- Each ECS task can have its own IAM role, to follow least privilege.
試験では
- “Move a legacy app to AWS with the least operational effort and no servers to manage” points to a container on Fargate.
- “The company already runs Kubernetes” points to Amazon EKS.
- “An event-driven job runs for several hours” points to Fargate, not Lambda.
- “Keep user uploads when containers are replaced” points to Amazon S3 or EFS, not the container disk.
混同しやすいもの
Amazon Elastic Container Service (Amazon ECS)Choose Fargate or EC2, pick the right IAM role, and scale services behind a load balancer.
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.
このタスクの内容 · 2.1
- Microservices and stateless design
- Multi-tier architectures
- Event-driven and loose coupling patterns
- Serverless application patterns
- AWS Amplify and AWS Device Farm
- Horizontal vs vertical scaling
- Caching strategies
Load Balancing
API Gateway
- When and how to containerize
SQS
SNS
EventBridge
Step Functions
MQ
Secrets Manager
- Choosing purpose-built services
- Choosing object, file or block
Lambda
- Read replicas
ElastiCache
CloudFront
Global Accelerator
Transfer Family
S3
EFS
EBS
Fargate
ECS
EKS