A classic Heroku-style Django monolith migrated to AWS ECS Fargate via deploy-stack's Procfile Importer.
This repository demonstrates how deploy-stack automatically parses a Procfile and translates it into a highly available, multi-container AWS architecture—spinning up both a public Web Service and an isolated Worker Service from a single Docker image.
Run the Trust Engine to preview how the Procfile maps to AWS infrastructure:
npx deploy-stack apply --dry-runNotice how the CLI automatically detects the Celery worker and provisions a separate, private Fargate cluster for background tasks while routing the Gunicorn web process through the ALB.
This configuration provisions an Application Load Balancer (ALB), an RDS PostgreSQL database, and two ECS Fargate services (Web + Worker: Micro: 0.25 vCPU, 512MB RAM).
- Estimated Baseline: ~$54.27 / month
- Hourly Rate: ~$0.074 / hour
- Testing for an afternoon costs less than $0.30 before tearing down.
⚠️ Note: You are solely responsible for all AWS charges incurred. Always set up AWS Budget Alerts for active workloads.
Generate and apply the cloud stack directly from your project root. The CLI will automatically parse Procfile and detect core.wsgi:
npx deploy-stack applyPush your local .env variables (like DJANGO_SECRET_KEY) directly to encrypted AWS Secrets Manager vaults:
npx deploy-stack secrets push .envCommit and push your repository to GitHub:
git add .
git commit -m "feat: migrate to aws via deploy-stack"
git push origin mainThe GitHub Actions workflow uses AWS IAM OpenID Connect (OIDC) to securely build the container once and deploy it across both the Web and Worker services simultaneously.
By default, Gunicorn binds to 127.0.0.1:8000 (localhost). Inside a Docker container on AWS, this causes the Load Balancer to fail with a 502 Bad Gateway.
You must update your Procfile to bind to all network interfaces (0.0.0.0):
web: gunicorn core.wsgi -b 0.0.0.0:8000 --log-file -
AWS constantly pings your container to ensure it is alive. Ensure your urls.py returns a 200 OK at your configured path (e.g., /up).
To tear down all provisioned resources (ALB, ECS Web/Worker, RDS, networking, and S3 state bucket) and halt AWS billing:
npx deploy-stack destroy --yes