Migration Guide
Migrating from Heroku to AWS: Postgres and Beyond
Practical guide for engineering teams migrating off Heroku — covering Postgres to RDS, Dynos to EC2 or Fargate, buildpack-to-Docker conversion, and CI/CD re-plumbing on AWS.
Heroku changed the developer experience permanently when it launched in 2007. git push heroku main deploying a production application was genuinely magical. For over a decade, Heroku was the default answer for teams that wanted to ship fast without managing infrastructure.
The calculus shifted in November 2022 when Heroku retired its free tier and shortly after discontinued its cheapest database plans. Teams that had been staying on Heroku for cost or inertia reasons suddenly had a concrete reason to evaluate AWS. This guide is for those teams.
We are an AWS Select Tier Consulting Partner. We will be direct about what Heroku does better — and what makes AWS the stronger long-term platform for most teams.
Heroku to AWS Service Mapping
| Heroku Service | AWS Equivalent | Notes |
|---|---|---|
| Dynos (web) | ECS Fargate or EC2 | Fargate for containers; EC2 for lift-and-shift or simpler setup |
| Dynos (worker) | ECS Fargate tasks or Lambda + SQS | Lambda for event-driven workers; Fargate for long-running processes |
| Heroku Postgres | Amazon RDS (PostgreSQL) | RDS adds Multi-AZ, read replicas, automated snapshots |
| Heroku Redis | Amazon ElastiCache for Redis | ElastiCache adds cluster mode and Global Datastore |
| Heroku Scheduler | Amazon EventBridge Scheduler + Lambda | EventBridge Scheduler provides cron-based invocation of Lambda functions |
| Heroku Pipelines | AWS CodePipeline or GitHub Actions | GitHub Actions is the simpler starting point for most teams |
| Heroku Review Apps | No direct equivalent | Approximated with ECS task-per-branch or Lambda function URLs |
| Heroku Add-ons | AWS Marketplace or native services | Many Heroku add-on vendors also have AWS Marketplace listings |
| Config Vars | AWS Systems Manager Parameter Store or Secrets Manager | Secrets Manager for sensitive values; Parameter Store for non-sensitive config |
Cost Comparison
Heroku’s pricing after the 2022 changes is no longer competitive for most workloads.
Compute
| Plan | Heroku | AWS Equivalent | AWS Monthly Cost |
|---|---|---|---|
| 512 MB / 1x CPU | Standard-1X — $25/month | EC2 t3.small (2 vCPU, 2 GB) | ~$15/month |
| 1 GB / 2x CPU | Standard-2X — $50/month | EC2 t3.medium (2 vCPU, 4 GB) | ~$30/month |
| Container-based | Eco Dynos at $5/month each | ECS Fargate (0.25 vCPU, 0.5 GB) | ~$8/month |
Add an Application Load Balancer (~$16/month) to the AWS side — Heroku’s routing tier is included. At 2+ Dynos, AWS pulls ahead on cost.
Managed Postgres
| Plan | Heroku | AWS RDS Equivalent | AWS Monthly Cost |
|---|---|---|---|
| Basic (1 GB storage, no HA) | $9/month | db.t3.micro (1 vCPU, 1 GB) | ~$14/month |
| Standard-0 (64 GB storage, follower optional) | $50/month | db.t3.small (2 vCPU, 2 GB) | ~$28/month |
| Standard-2 (256 GB, HA) | $200/month | db.t3.large Multi-AZ | ~$130/month |
RDS is cheaper at every tier once you account for Multi-AZ — Heroku’s HA pricing is significantly higher than RDS Multi-AZ.
The Biggest Migration Challenge: Buildpack to Docker
Heroku’s buildpack system is elegant. You push code; Heroku detects the runtime, installs dependencies, and produces a slug. No Dockerfile required.
AWS expects a container image. Converting a Heroku app to Docker is the most common stumbling block in this migration.
The process:
- Create a
Dockerfilethat replicates what your buildpack does: install your language runtime, copy your code, install dependencies, and set an entrypoint. - Test the container locally with
docker buildanddocker run, passing environment variables to simulate Heroku Config Vars. - Push the image to Amazon ECR (Elastic Container Registry).
- Reference the ECR image in your ECS task definition or Lambda container image.
For Rails, Django, Node.js, and other common frameworks, community-maintained Docker base images make this straightforward. The heroku/heroku Docker base images are also an option for a more direct lift-and-shift. For exotic buildpacks or multi-buildpack stacks, expect additional debugging time.
Migrating Heroku Postgres to RDS
Option 1: pg_dump / pg_restore (Small to Medium Databases)
# Export from Heroku
heroku pg:backups:capture --app your-app-name
heroku pg:backups:download --app your-app-name
# Restore to RDS
pg_restore --verbose --clean --no-acl --no-owner \
-h your-rds-endpoint.rds.amazonaws.com \
-U postgres -d your_database_name \
latest.dumpThis approach requires downtime equal to your dump-and-restore time. For databases under ~10 GB, expect 15–60 minutes.
Option 2: AWS DMS (Large Databases or Near-Zero Downtime)
AWS Database Migration Service treats Heroku Postgres as a standard PostgreSQL source. Configure DMS with a full-load task followed by ongoing change data capture (CDC) replication. This keeps RDS in sync with Heroku while you validate your application. Cutover is a connection string change and a DMS task stop.
Post-Migration Steps
- Update your environment variables (Heroku Config Vars → AWS Secrets Manager or Parameter Store) to point at the new RDS endpoint.
- Remove the
ssl=trueHeroku Postgres certificate workaround if present; RDS uses standard SSL certificates. - Test all database-heavy application paths before cutting over production traffic.
CI/CD Re-plumbing: Heroku Auto-Deploy → GitHub Actions
Heroku’s GitHub auto-deploy integration is one of its best features — push to main, get a deployment. AWS does not have an equivalent single-click integration, but GitHub Actions fills the gap effectively.
A minimal pipeline for an ECS Fargate deployment:
- On push to
main, GitHub Actions builds your Docker image and pushes it to ECR. - A subsequent job updates the ECS service with the new task definition, triggering a rolling deployment.
This requires ~60 lines of YAML versus Heroku’s zero-line integration. The trade-off is control — you can add test gates, approval steps, multi-environment promotion, and deployment notifications.
For teams migrating from Heroku Pipelines (staging → production promotion), the AWS equivalent is CodePipeline with ECR and ECS deploy stages, or a multi-environment GitHub Actions workflow with manual approval gates.
What Heroku Does Better
Heroku’s advantages are real and worth naming:
- Developer experience.
git push heroku mainremains unmatched for speed. AWS deployment always requires more configuration. - Zero DevOps required. No VPC, no security groups, no IAM roles. For a 2-person team shipping fast, this matters.
- Review Apps. Heroku creates per-PR preview environments automatically. AWS has no equivalent native feature — approximating this with ECS or Lambda requires custom tooling.
- Add-on ecosystem. One-click Postgres, Redis, SendGrid, Papertrail, and hundreds of others. AWS services require more configuration.
When AWS Wins
- Cost at scale. Beyond 2–3 Standard Dynos and a Standard-0 Postgres, AWS is materially cheaper.
- Compliance. HIPAA, PCI DSS, and FedRAMP are not available on Heroku.
- AWS service integration. If your app needs SES, SQS, Bedrock, or any other AWS service, running on AWS itself reduces latency and eliminates cross-cloud egress charges.
- Infrastructure control. VPC isolation, custom networking, private subnets, and security groups are unavailable on Heroku.
- Data residency. AWS provides 33 regions globally; Heroku is limited to a handful of regions.
Ready to Migrate?
FactualMinds handles Heroku-to-AWS migrations — from Postgres migration and Docker containerization to ECS Fargate setup and CI/CD pipeline re-plumbing.
Talk to our team about your Heroku migration or learn more about our AWS Migration service.
Frequently Asked Questions
Why should I migrate from Heroku to AWS?
Heroku ended its free tier in November 2022 and retired several entry-level database plans, making the cost comparison with AWS far less favorable than it used to be. At any non-trivial scale, AWS is cheaper. Beyond cost, the migration makes sense when you need compliance certifications (Heroku has SOC 2; AWS has SOC 2, HIPAA, PCI DSS, and more), need to use other AWS services (SES, SQS, Lambda, Bedrock), or want more control over your infrastructure. Teams migrating often find that AWS is more complex upfront but provides significantly more flexibility as their application grows.
How do I migrate Heroku Postgres to RDS?
The standard path is pg_dump and pg_restore. Export your Heroku Postgres database with `heroku pg:backups:capture && heroku pg:backups:download`, then restore into RDS using `pg_restore`. For larger databases or near-zero-downtime migrations, AWS DMS supports Heroku Postgres as a source (it is standard PostgreSQL) and can replicate ongoing changes while you validate your application against RDS. Plan for connection string updates — your app will need to point to the new RDS endpoint.
Is AWS cheaper than Heroku?
For most workloads at any meaningful scale, yes. A Heroku Standard-1X Dyno costs $25/month; an AWS EC2 t3.small with comparable specs costs around $15/month. Heroku Postgres Standard-0 is $50/month; RDS db.t3.small (PostgreSQL) runs around $28/month. The gap widens with scale. The trade-off is operational overhead — Heroku is faster to deploy and requires less DevOps knowledge. AWS requires managing VPCs, security groups, and deployment pipelines, but those one-time costs amortize quickly.
What replaces Heroku Dynos on AWS?
It depends on your workload. For web processes with variable traffic, ECS Fargate is the closest equivalent — you define container resources and Fargate handles the underlying infrastructure. For simple single-instance applications, EC2 is simpler to reason about. For event-driven or background worker processes, Lambda is often a better fit than Dynos. The Heroku worker Dyno type maps naturally to ECS Fargate tasks running in the background or Lambda functions triggered by SQS queues.
How do I move my Heroku app to AWS?
The migration has four main steps: (1) Convert your Heroku buildpack app to a Docker container image; (2) Migrate your Postgres database to RDS using pg_dump/restore or AWS DMS; (3) Provision ECS Fargate, EC2, or Lambda on AWS with equivalent compute resources; (4) Re-plumb your CI/CD pipeline from Heroku auto-deploy to GitHub Actions pushing to ECR and deploying to ECS or Lambda. Expect 2–6 weeks depending on application complexity and team familiarity with AWS.
Need Help Choosing the Right Cloud Platform?
Our AWS-certified architects help you evaluate cloud platforms based on your specific requirements, workloads, and business goals.
