This project implements a production-ready cloud-native API with full observability and infrastructure as code.
┌─────────────────────────────────────────────────────────────────────┐
│ AWS Cloud (us-east-1) │
│ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ VPC (10.0.0.0/16) │ │
│ │ │ │
│ │ ┌──────────┐ ┌─────────────────────────────────────┐ │ │
│ │ │ Internet │ │ Application Load Balancer │ │ │
│ │ │ Gateway │───▶│ (HTTP :80 → Target Group) │ │ │
│ │ └──────────┘ └─────────────┬───────────────────────┘ │ │
│ │ │ │ │
│ │ ┌─────────────────┼─────────────────┐ │ │
│ │ │ │ │ │ │
│ │ ┌──────────▼──────┐ ┌──────▼───────────┐ │ │ │
│ │ │ Subnet AZ-1 │ │ Subnet AZ-2 │ │ │ │
│ │ │ 10.0.1.0/24 │ │ 10.0.2.0/24 │ │ │ │
│ │ │ │ │ │ │ │ │
│ │ │ ┌─────────────┐ │ │ ┌──────────────┐ │ │ │ │
│ │ │ │ ECS Fargate │ │ │ │ ECS Fargate │ │ │ │ │
│ │ │ │ Task #1 │ │ │ │ Task #2 │ │ │ │ │
│ │ │ │ (API:8000) │ │ │ │ (API:8000) │ │ │ │ │
│ │ │ └─────────────┘ │ │ └──────────────┘ │ │ │ │
│ │ └─────────────────┘ └──────────────────┘ │ │ │
│ │ │ │ │
│ │ ECS Cluster (Container Insights enabled) │ │ │
│ │ │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │
│ ┌──────────────┐ ┌──────────────────┐ │
│ │ ECR │ │ CloudWatch │ │
│ │ (Images) │ │ (Logs: 30d) │ │
│ └──────────────┘ └──────────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────┐
│ Docker Compose Network │
│ │
│ ┌──────────────┐ ┌─────────────┐ ┌──────────────┐ │
│ │ FastAPI │ │ Prometheus │ │ Grafana │ │
│ │ :8000 │──▶│ :9090 │──▶│ :3000 │ │
│ │ │ │ (scrape │ │ (visualize │ │
│ │ /health │ │ /metrics) │ │ metrics) │ │
│ │ /metrics │ └─────────────┘ └──────────────┘ │
│ │ /docs │ │
│ └──────────────┘ ┌─────────────┐ │
│ │ LocalStack │ │
│ │ :4566 │ │
│ │ (AWS Mock) │ │
│ └─────────────┘ │
└─────────────────────────────────────────────────────────┘
Push to GitHub
│
▼
┌─────────┐ ┌──────────┐ ┌───────────────┐ ┌──────────────┐ ┌──────────┐
│ Lint │────▶│ Test │────▶│ Security Scan │────▶│ Docker Build │────▶│ Push ECR │
│ (ruff) │ │ (pytest) │ │ (Trivy) │ │ (Distroless) │ │ (AWS) │
└─────────┘ │ cov ≥80% │ │ CRITICAL/HIGH │ └──────────────┘ └──────────┘
└──────────┘ └───────────────┘
| Decision | Rationale |
|---|---|
| Distroless runtime | No shell = no RCE attack vector. Image ~80MB vs ~900MB |
| Multi-AZ deployment | Tasks distributed across 2 AZs for high availability |
| Prometheus pull model | API exposes /metrics; Prometheus scrapes every 10s |
| Structured JSON logging | Machine-parseable logs for CloudWatch / ELK / Datadog |
| Health check separation | /health (liveness) vs /ready (readiness) per K8s/ECS best practices |
| LocalStack for testing | Full AWS emulation without credentials or costs |