Ryz Labs/Migrations/Heroku to AWS
Migrations

Heroku to AWS Migration Runbook

A platform move, not a rewrite: containers on ECS Fargate, Heroku Postgres to RDS or Aurora, add-ons mapped one by one, and a DNS cutover you can reverse.

Moving from Heroku to AWS is a platform migration: you keep the application code, turn each Procfile process type into a container service (usually on ECS Fargate), move Heroku Postgres to RDS or Aurora PostgreSQL, and replace every add-on with an AWS service or a vendor you already pay. Do it incrementally, one process type and one dependency at a time, behind a reversible DNS switch. The thing that decides success is the database cutover: how you copy Heroku Postgres to AWS, how long writes are frozen, and whether you can point traffic back at Heroku if the first hour goes wrong.

Why teams migrate now

Heroku is not shutting down. No end-of-life date has been announced on any official Heroku page, and you should ignore third-party posts that say otherwise. What changed is direction. On February 6, 2026, Heroku's chief product officer wrote that the company is moving to a "sustaining engineering model" focused on stability, security and reliability "rather than introducing new features." The same post says Enterprise Account contracts are no longer offered to new customers (existing contracts are honored and can renew), and that self-serve credit-card customers see no change to pricing or day-to-day usage. A March 19, 2026 follow-up said features continue only where they fit those sustaining goals, citing a 1 GB default slug size and CLI v11.

This comes after the free tier ended. Heroku announced in August 2022 that it would stop free plans and begin shutting down free dynos and data services on November 28, 2022. Today the pricing page lists Eco at $5, Basic at $7, Standard-1X at $25 and Standard-2X at $50 per month, with Heroku Postgres Essential-0 at $5, Essential-1 at $9 and Essential-2 at $20, and no free dyno or database plan.

The consequence is a roadmap question, not an emergency. If you planned to grow into Heroku Enterprise, that door is closed for new customers. If you need private networking, fine-grained IAM or a control your auditors expect in your own cloud account, the platform is unlikely to add it now. Nothing forces a move this quarter, which is why you can do it carefully.

AWS does not publish a dedicated Heroku migration guide on docs.aws.amazon.com. It does offer two things: the AWS Startups migration page says Heroku migrations are available in its IDE plugin, and a September 17, 2026 AWS blog post, "Simplify application migrations to AWS with Elastic Beanstalk", aimed at teams that have outgrown Heroku, Render or Railway. Neither replaces a runbook.

Before you start: inventory and baseline

Heroku hides a lot of platform behavior behind git push. Write it down first.

The strangler-fig plan, phase by phase

On a platform move, the strangler fig works on process types and dependencies, not routes. Move what is cheap to move back first; save the database for last.

Phase 0: Landing zone and pipeline

Set up separate production and non-production AWS accounts, a VPC with private subnets for tasks and databases (public subnets only for load balancers), and infrastructure as code from day one (Terraform, AWS CDK or CloudFormation). Create an ECR repository per app. Use GitHub Actions OIDC federation so no long-lived access keys exist. Pick the compute target: ECS on Fargate for control over task definitions, sidecars and networking; Elastic Beanstalk for the closest managed-platform feel; App Runner for a single stateless web service (check its current status and regions first). See Kubernetes vs ECS if someone is pushing for EKS. Exit criteria: a placeholder container deploys from a merged pull request to a non-production ECS service with no console clicks.

Phase 1: Containerize with parity

Replace buildpacks with a Dockerfile, or Cloud Native Buildpacks via the pack CLI. Each Procfile line becomes a separate ECS service or task definition that shares one image and changes only the command. The release phase (migrations, asset upload) becomes a one-off ECS RunTask step in the pipeline that must succeed before the new task set rolls out. Keep the twelve-factor habits: bind to PORT, log to stdout, treat disk as disposable, handle SIGTERM within the ECS stop timeout. Move config vars into AWS Systems Manager Parameter Store for plain settings and AWS Secrets Manager for secrets, injected through the task definition's secrets block so the app still reads environment variables. Exit criteria: tests and characterization tests pass on AWS staging, same commit as Heroku staging, against restored production data.

Phase 2: Add-ons and background work

Move the add-ons that do not hold primary data. Heroku Key-Value Store becomes Amazon ElastiCache; if Redis only holds cache and job queues, you can start the AWS workers on a fresh cluster and let Heroku drain its queue rather than copying keys. Heroku Scheduler entries become EventBridge Scheduler rules that call ECS RunTask with the same command. Logplex drains become CloudWatch Logs, or FireLens routing to your existing logging vendor. Heroku Metrics becomes Container Insights plus your APM. Flag Heroku Connect early: replacing Salesforce sync is its own project. Exit criteria: every add-on has an AWS or direct-vendor replacement running in staging, and the scheduler and worker characterization tests pass there.

Phase 3: Database replication

Create the target RDS for PostgreSQL or Aurora PostgreSQL instance on the same major Postgres version, with the same extensions installed. Logical replication (a publication on Heroku, a subscription on RDS) keeps the target current and makes the final cutover short, but first confirm your Heroku Postgres plan lets you create the publication and replication slot you need. If it does not, AWS Database Migration Service with change data capture is the next option, and pg_dump plus pg_restore with a write freeze is the simplest. Logical replication traps: sequence values are not replicated, so reset every sequence before the target takes writes; DDL is not replicated, so freeze schema migrations while replication runs; tables without a primary key cannot replicate updates and deletes until you set a replica identity; large objects are not copied. Verify with row counts and per-table checksums. Exit criteria: lag near zero under production load, checksums match, and a timed full dump and restore so you know the fallback freeze.

Phase 4: Traffic cutover

Canary first: with Route 53 weighted records, send a small share of traffic to the ALB while Heroku serves the rest. The trap here is the database: AWS tasks reading from RDS while Heroku writes to Heroku Postgres is only safe on read-only paths fed by replication. Measure round-trip latency from AWS to Heroku Postgres before running AWS compute against it; chatty ORMs often make it too slow. Canary read-only and health endpoints, then do one cutover window for writes: maintenance mode on, workers scaled to zero, replication drained, sequences reset, DATABASE_URL in Secrets Manager pointed at RDS, AWS services scaled up, DNS weight moved to AWS. Exit criteria: all production traffic and all writes on AWS, error rate and p95 latency within your baseline, Heroku still deployable on the same commit.

Phase 5: Decommission and review apps

Keep Heroku warm for an agreed period, then scale to zero, take a final backup, remove add-ons and close the apps. Replace review apps with preview environments: a GitHub Actions workflow that, per pull request, deploys an ECS service (or App Runner service) with its own target group rule or subdomain, seeded from a sanitized snapshot, and tears it down on merge. Turn on cost allocation tags per app and environment, AWS Budgets alerts, and a weekly Cost Explorer review: a few dyno lines become separate compute, load balancer, NAT gateway, CloudWatch and storage lines. Exit criteria: no Heroku charges, preview environments in use by the team, and an owner for the monthly cost review.

PhaseGoalKey techniqueExit criteria
0. Landing zoneAccounts, VPC, IAM, pipelineIaC, ECR, GitHub Actions OIDCMerged PR deploys a container with no console clicks
1. ContainerizeSame commit runs on AWSDockerfile or pack CLI, one task definition per Procfile line, Secrets ManagerTests and characterization tests pass on AWS staging
2. Add-onsReplace non-database add-onsElastiCache, EventBridge Scheduler, CloudWatch or FireLensWorkers and scheduled jobs verified in staging
3. DatabaseRDS or Aurora in syncLogical replication, DMS, or timed pg_dump rehearsalNear-zero lag, checksums match, fallback freeze timed
4. CutoverProduction on AWSWeighted DNS canary, write freeze, DATABASE_URL swapErrors and p95 within baseline, Heroku still deployable
5. DecommissionRetire Heroku, preview envsPer-PR ECS services, cost tags, BudgetsNo Heroku charges, cost review owned

Cutover and rollback

Traffic moves by DNS. Two days ahead, lower the TTL on every record that points at Heroku (the CNAME to your herokudns.com target, or the ALIAS/ANAME at the apex) to 60 seconds. Request and validate the ACM certificate for every hostname in advance using DNS validation, so TLS is ready on the ALB before any traffic arrives. Give partners who allowlist your outbound IPs the NAT gateway Elastic IPs well ahead.

For the database you have two patterns. With logical replication, the write freeze lasts as long as it takes to stop writers, let lag reach zero, reset sequences and swap DATABASE_URL. With pg_dump, the freeze lasts as long as your rehearsed dump and restore. Either way, put the Heroku app into maintenance mode (heroku maintenance:on), scale worker and clock dynos to zero so no job writes to the old database,, then swap. Before opening traffic, smoke test AWS through a temporary hostname and compare responses with Heroku's.

Go/no-go checklist:

Rollback path per phase:

Risk matrix

RiskLikelihoodImpactMitigationEarly warning signal
Sequences not reset after logical replication, so inserts collide on primary keysMediumHighScript that sets every sequence from MAX(id) as a go/no-go stepDuplicate key errors in the first inserts after cutover
Heroku Postgres plan does not allow the publication or replication slot you planned onMediumMediumConfirm in Phase 3 week one; keep DMS and timed pg_dump as fallbacksPermission errors creating the publication
Extension missing or different on RDS (PostGIS, pg_trgm, custom types)MediumHighCompare pg_extension lists; restore a full copy into RDS in Phase 1Restore errors or failing queries in staging
Buildpack behavior not reproduced in Docker (system packages, asset compile, locale)HighMediumDiff installed packages and env between a dyno and the containerCharacterization tests fail only on AWS
Scheduled jobs run twice or not at all during cutoverMediumHighDisable Heroku Scheduler and enable EventBridge in one checklist step; make jobs idempotentDuplicate emails or missing nightly reports
Partners block traffic from new outbound IPsMediumHighPublish NAT gateway Elastic IPs early; test calls from AWS staging403s or timeouts on partner APIs from staging
ACM certificate not validated at cutoverLowHighIssue with DNS validation days ahead; alarm on pending statusCertificate still pending validation the day before
Request timeouts and connection limits behave differently (ALB idle timeout, RDS max connections)MediumMediumSet ALB idle timeout deliberately; add RDS Proxy or PgBouncer; load test5xx spikes or connection errors under load test
AWS bill grows past the Heroku bill through NAT, logs and idle environmentsHighMediumCost tags, Budgets alerts, log retention limits, tear down preview envsDaily cost trend above forecast in Cost Explorer

Typical team shape

You need people who have run production on both platforms: a tech lead who owns the cutover plan and the rollback call; two senior engineers who know the application's language and framework and can debug buildpack-to-Docker differences; one DevOps or platform engineer with deep AWS networking, IAM and RDS experience, which is where AWS developers and DevOps engineers pay off; and part-time QA for the characterization tests and post-cutover comparison. Add a PM only if several product teams share the Heroku account. Many teams begin with a pod of 3 to 5 senior engineers (a tech lead plus engineers), and a full pod is about seven.

Ryz engineers on your team start from $7,000 per month (our published range is $7,000–$15,000 per engineer per month, mostly mid-level to senior), quoted per team. Project cost = team size × months × monthly rate, and months depend on app count, add-ons needing real replacement, and accepted database downtime. See AWS developer rates for the seniority breakdown. Ryz engineers work on your team, reporting to your leads, inside your AWS accounts, repos and on-call rotation. Once you say go, engineers can typically start in under two weeks. Scope your team with us, or read how our cloud migration teams run this work.

Where an AI pod helps (and where it doesn't)

Most of a Heroku exit is translation and checking, and that is where an AI pod earns its keep. Our AI pod uses coding assistants to draft a Dockerfile from the buildpack list and Procfile, to turn a heroku config export into Terraform for Parameter Store and Secrets Manager entries (names only, values loaded by a human), to draft ECS task definitions per process type, and to convert Heroku Scheduler entries into EventBridge rules. It drafts characterization tests from your route list and logs, and triages diffs: Heroku versus AWS response bodies, and CloudWatch error clusters after a canary.

Where it does not help: setting the write-freeze length, choosing logical replication or pg_dump, judging least-privilege IAM, and making the rollback call. Every generated Dockerfile, policy and task definition goes through human review and must pass the same characterization tests that ran against Heroku. Generated IAM policies get read line by line; an over-broad wildcard is easy to miss.

When not to migrate (yet)

Ryz is not the right fit if you want a board-level cloud strategy engagement or a proprietary migration platform; our teams do the hands-on engineering.

Related

FAQ

How long does a Heroku to AWS migration take?

It depends on the number of apps and process types, how many add-ons need a real replacement rather than a new API key, the size of the Postgres database and whether logical replication is available, and how much write downtime the business will accept. Size it after the inventory, not before.

Can we run Heroku and AWS in parallel?

Yes, and you should. Web and worker processes can run on both behind a weighted DNS split while Postgres replicates to RDS with Heroku as primary. The constraint is writes: only one database should accept them at a time, so the parallel period ends with a short, planned write freeze when RDS becomes primary.

Should we use ECS Fargate, App Runner or Elastic Beanstalk?

ECS on Fargate gives the most control over task definitions, sidecars, networking and per-process scaling, and it maps cleanly to Procfile process types. Elastic Beanstalk is closest to the Heroku experience and is what AWS's own Heroku-oriented blog post uses. App Runner is the simplest for a single stateless web service.

Do we need to freeze features during the migration?

Not for most of it. Feature work continues as long as each deploy goes to both Heroku and AWS staging. You do need a schema freeze while logical replication runs, because DDL does not replicate, and a short write freeze at the database cutover itself.

What does a Heroku to AWS migration cost?

Engineering cost is team size multiplied by months multiplied by the monthly rate per engineer, and the months come from your inventory. Separately, model AWS run cost before cutover: compute, load balancers, RDS, ElastiCache, NAT gateways, logs and preview environments bill independently, so tag and budget from day one.

Questions we didn't answer? Email info@ryzlabs.com.

Thanks — your message has been sent. We’ll get back to you soon.

Something went wrong while sending your message. Please try again or email info@ryzlabs.com.

Explore Ryz Labs

Software development servicesAI development companyIndustriesStaff augmentationAI pod teamsNearshore software developmentHire engineers by roleEngineer ratesGuidesBuyer guidesCase studiesHow we vet engineers

Ryz Labs

Senior engineers on your team. AI pod teams that ship.

Tell us what you're building. You get a scoped plan, a price and the names of the people who would do the work.

  • Only the top 1% of tens of thousands interviewed make it
  • On US business hours, including New York hours
  • Trusted by Fortune 500 engineering teams

Tell us who you need

A Ryz partner replies with a scoped team plan.

Start a conversation →

Prefer to talk? Book a 15-min call →