Project summary
A small task-management API is the workload. The real subject is the platform that deploys and operates it securely and repeatably.
- role
- Independent cloud and DevOps engineering project
- runtime
- Amazon ECS Fargate behind an Application Load Balancer
- data
- Private Amazon RDS PostgreSQL with SQLAlchemy and Alembic
- delivery
- GitHub Actions with short-lived AWS OIDC sessions
- infrastructure
- Six reusable Terraform modules with encrypted S3 remote state
Architecture
HTTPS terminates at the load balancer. ECS tasks accept traffic only from the ALB security group, and PostgreSQL accepts traffic only from the ECS security group.
Request path
Delivery path
Provisioning path
What I built
I designed and implemented the application, the cloud infrastructure, the secure deployment workflow, the operational controls and the documentation.
Application
FastAPI REST API with typed Pydantic models, SQLAlchemy persistence, CRUD endpoints, process health checks, database readiness checks, Swagger and ReDoc.
Container platform
A Python 3.12 slim image with dependency-layer caching, a non-root runtime user, container health checks and Amazon ECR image storage.
Infrastructure
Reusable Terraform modules for networking, security, database, load balancing, ECS and monitoring, composed per environment with remote state.
CI/CD deployment flow
No persistent AWS access keys, and a traceable application revision for every commit. Replay the run below.
- test
- ruff
- pytest
- build
- docker build
- auth
- aws oidc
- publish
- push ECR
- release
- task def
- migrate
- deploy
- update
- wait stable
- verify
- smoke test
- environmentAPI docs
Security and reliability
Controls cover identity, network isolation, secrets, encrypted transport, safe container execution and automated deployment checks.
Security controls
- GitHub Actions OIDC trust restricted by repository and branch
- Separate ECS task role and execution role
- Private, non-public RDS PostgreSQL
- Security groups chained ALB to ECS to RDS
- Database credentials in AWS Secrets Manager
- HTTPS with ACM certificates and HTTP-to-HTTPS redirect
- Encrypted, versioned Terraform state
- Non-root application container
Reliability controls
- Process health and database readiness endpoints
- Container and ALB target-group health checks
- ECS deployment circuit breaker with rollback
- One-off migration task with exit-code check
- Service-stability waiter before smoke testing
- HTTPS smoke test with retries
- CloudWatch logs and four health alarms
- Documented recovery and rollback procedures
Engineering decisions and trade-offs
No NAT Gateway
Who owns the task definition
Backward-compatible migrations
Cost-controlled operations
The AWS runtime starts for demos and stops afterwards without destroying persistent infrastructure. Flip the switch to see what changes.
Environment
Two PowerShell scripts, one for each direction.
✓ environment running. The API docs are online.
Start workflow
Starts RDS, waits until the database is available, then scales the ECS service to one running task.
Stop workflow
Scales ECS compute to zero and temporarily stops RDS. Networking, ALB, ECR, IAM, logs, Terraform state and database storage stay provisioned.
Limitations and roadmap
Production-inspired, not fully production-ready. The gaps are listed as explicit next steps.
Current limitations
- Single-AZ RDS and a single ECS task
- No application authentication or authorization
- No WAF, autoscaling, rate limiting or pagination
- No separate production environment
- No published coverage threshold or integrated image and IaC scanner