Phase Plans (5 files): - 04-RESEARCH.md: Domain research on Docker limits, healthchecks, EC2 parallels - 04-VALIDATION.md: Success criteria and validation strategy - 04-01-PLAN.md: Test infrastructure (RED phase) - 04-02-PLAN.md: Diátxis documentation - 04-03-PLAN.md: Infrastructure implementation (GREEN phase) Test Scripts (6 files, 1300+ lines): - 01-resource-limits-test.sh: Validate INF-03 compliance - 02-healthcheck-test.sh: Validate healthcheck configuration - 03-enforcement-test.sh: Verify resource limits with docker stats - 04-verify-infrastructure.sh: Infrastructure verification - 99-final-verification.sh: End-to-end student verification - run-all-tests.sh: Test orchestration with fail-fast - quick-test.sh: Fast validation (<30s) Documentation (11 files, 2500+ lines): Tutorials (3): - 01-set-resource-limits.md: EC2 instance types, Docker limits syntax - 02-implement-healthchecks.md: ELB health check parallels - 03-dependencies-with-health.md: depends_on with service_healthy How-to Guides (4): - check-resource-usage.md: docker stats monitoring - test-limits-enforcement.md: Stress testing CPU/memory - custom-healthcheck.md: HTTP, TCP, database healthchecks - instance-type-mapping.md: Docker limits → EC2 mapping Reference (3): - compose-resources-syntax.md: Complete deploy.resources reference - healthcheck-syntax.md: All healthcheck parameters - ec2-instance-mapping.md: Instance type mapping table Explanation (1): - compute-ec2-parallels.md: Container=EC2, Limits=Instance Type, Healthcheck=ELB Infrastructure: - docker-compose.yml: 5 services (web, app, worker, db, stress-test) All services: INF-03 compliant (cpus + memory limits) All services: healthcheck configured EC2 parallels: t2.nano, t2.micro, t2.small, t2.medium, m5.large - Dockerfile: Alpine 3.19 + stress tools + non-root user Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2.7 KiB
2.7 KiB
Reference: EC2 Instance Type Mapping
Tabella completa di mapping tra Docker resource limits e EC2 instance types.
Tabella di Mapping Completa
| Docker Compose | EC2 Instance | vCPUs | Memory | Costo/ora* | Use Case |
|---|---|---|---|---|---|
cpus: '0.5'memory: 512M |
t2.nano | 0.5 | 512 MB | $0.006 | Microservizi minimi |
cpus: '1'memory: 1G |
t2.micro | 1 | 1 GB | $0.012 | Dev/Test |
cpus: '1'memory: 2G |
t2.small | 1 | 2 GB | $0.024 | Web server |
cpus: '2'memory: 4G |
t2.medium | 2 | 4 GB | $0.048 | Application |
cpus: '2'memory: 8G |
m5.large | 2 | 8 GB | $0.096 | Production |
cpus: '4'memory: 16G |
m5.xlarge | 4 | 16 GB | $0.192 | High traffic |
cpus: '8'memory: 32G |
m5.2xlarge | 8 | 32 GB | $0.384 | Scalabile |
cpus: '16'memory: 64G |
m5.4xlarge | 16 | 64 GB | $0.768 | Enterprise |
*Costi indicativi per regione us-east-1
Famiglie Instance Types
General Purpose (m5, m6)
Equilibrato tra CPU, memoria, rete.
# m5.large - 2 vCPUs, 8 GB
cpus: '2'
memory: 8G
Use case: Web server, application server
Burstable (t2, t3)
Credit-based CPU, basso costo.
# t2.micro - 1 vCPU, 1 GB
cpus: '1'
memory: 1G
Use case: Dev, test, microservizi
Compute Optimized (c5, c6)
Alto ratio CPU/memoria.
# c5.xlarge - 4 vCPUs, 8 GB
cpus: '4'
memory: 8G
Use case: Batch processing, encoding
Memory Optimized (r5, r6)
Alto ratio memoria/CPU.
# r5.large - 2 vCPUs, 16 GB
cpus: '2'
memory: 16G
Use case: Database, caching
Docker Compose Examples
T2 Nano (Micro)
micro:
image: alpine:3.19
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
T2 Micro (Dev/Test)
dev:
image: node:alpine
deploy:
resources:
limits:
cpus: '1'
memory: 1G
T2 Small (Web)
web:
image: nginx:alpine
deploy:
resources:
limits:
cpus: '1'
memory: 2G
T2 Medium (Application)
app:
image: python:alpine
deploy:
resources:
limits:
cpus: '2'
memory: 4G
M5 Large (Production)
production:
image: myapp:latest
deploy:
resources:
limits:
cpus: '2'
memory: 8G
Shortcut Reference
Quick Copy-Paste
# T2 Nano
cpus: '0.5'; memory: 512M
# T2 Micro
cpus: '1'; memory: 1G
# T2 Small
cpus: '1'; memory: 2G
# T2 Medium
cpus: '2'; memory: 4G
# M5 Large
cpus: '2'; memory: 8G
# M5 XLarge
cpus: '4'; memory: 16G
Vedi Anche
- Tutorial: Configurare Limiti delle Risorse
- How-to: Selezionare Instance Type
- Explanation: Compute-EC2 Parallels