How We Migrated from Heroku to Amazon Web Services (AWS) Using Docker
Description and use
Migrating an application from Heroku to AWS using Docker reduced costs by 30 % and provided full infrastructure control.
Problem
The team needed to move their application from Heroku to AWS to gain more control over infrastructure, reduce costs, and improve scalability.
Outcome
The migration completed with a 30% reduction in monthly hosting costs, improved deployment speed, and full control over scaling and networking.
Workflow
- 1. Containerize the application using Docker, creating a Dockerfile that mirrors the Heroku buildpack environment.
- 2. Push the Docker image to Amazon ECR (Elastic Container Registry).
- 3. Set up an ECS cluster and define a task definition pointing to the ECR image.
- 4. Configure RDS for PostgreSQL and ElastiCache for Redis, migrating data from Heroku Postgres and Redis.
- 5. Update environment variables and secrets in ECS task definition and AWS Secrets Manager.
- 6. Deploy the ECS service with desired number of tasks and configure load balancer (ALB) for routing.
- 7. Test the application end-to-end, ensuring database connectivity and static asset serving from S3.
- 8. Switch DNS to point to the new ALB, monitor traffic, and decommission Heroku resources.
Evidence
We migrated from Heroku to AWS using Docker, which gave us more control and reduced costs.
- Record date: 2026-09-05T18:52:48.642Z