3.1.4 Resource Requirements
Identify Resource Requirements for Deployment
Lambda Resource Configuration
| Resource | Range | Mô tả |
|---|
| Memory | 128MB → 10,240MB | CPU scales proportionally |
| Timeout | 1s → 900s (15 min) | API GW max 29s |
| Ephemeral Storage | 512MB → 10,240MB | /tmp directory |
| Concurrency | Account default 1000 | Reserved/Provisioned |
ECS Task Definition Resources
{
"containerDefinitions": [{
"name": "my-app",
"image": "123456789012.dkr.ecr.us-east-1.amazonaws.com/my-app:latest",
"cpu": 256,
"memory": 512,
"memoryReservation": 256,
"portMappings": [{"containerPort": 8080}]
}],
"cpu": "256",
"memory": "512",
"requiresCompatibilities": ["FARGATE"]
}
| Launch Type | CPU/Memory | Mô tả |
|---|
| Fargate | Fixed combinations | Serverless, no EC2 management |
| EC2 | Instance-based | More control, spot instances |
Amazon EC2 cho Developer
| Concept | Mô tả |
|---|
| Instance Profile | IAM Role attached to EC2 (auto-rotated credentials) |
| User Data | Bootstrap script chạy khi launch (install packages, start services) |
| Security Groups | Virtual firewall (inbound/outbound rules) |
| Key Pairs | SSH access (ed25519 hoặc RSA) |
| Instance Metadata | http://169.254.169.254/latest/meta-data/ |
# IMDSv2 (recommended — token-based)
TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" \
-H "X-aws-ec2-metadata-token-ttl-seconds: 21600")
curl -H "X-aws-ec2-metadata-token: $TOKEN" \
http://169.254.169.254/latest/meta-data/instance-id
- IMDSv2 = token-based (more secure, recommended)
- Retrieve instance ID, region, IAM role credentials
- User data script available tại
/latest/user-data
User Data (Bootstrap)
#!/bin/bash
yum update -y
yum install -y httpd
systemctl start httpd
aws s3 cp s3://my-bucket/app.zip /var/www/html/
Elastic Beanstalk Capacity
| Setting | Options |
|---|
| Environment type | Single instance / Load balanced |
| Instance type | t3.micro → m5.xlarge, etc. |
| Auto Scaling | Min/Max instances, scaling triggers |
| Load Balancer | ALB, NLB, Classic |
RDS/Aurora Sizing
| Factor | Consideration |
|---|
| Instance class | db.t3.micro → db.r5.24xlarge |
| Storage | gp3, io1, magnetic |
| Multi-AZ | Standby replica for HA |
| Read Replicas | Up to 5 (RDS) / 15 (Aurora) |
Exam Tip: Lambda memory = CPU. Fargate = fixed CPU/memory combos. Beanstalk Auto Scaling cho dynamic workloads. RDS Multi-AZ cho HA, Read Replicas cho read scaling.