Migrate your application from Heroku to AWS

Tutorial on how to migrate your application from Heroku to AWS with a PostgreSQL database

This tutorial describes how to migrate your web application running on Heroku to AWS with Qovery. In the article, you learn how to migrate a Node.js application connected to Heroku Postgres as a backing service on the Heroku platform. It covers all required steps you need to take to deploy your application on AWS and transfer your data from Heroku Postgres to the database managed by AWS via Qovery.

The application is a simple Node.js Todo web app that uses PostgreSQL as a persistence layer.

If you have an existing app, you do not have to deploy our sample application to benefit from this guide. Otherwise, you can try to deploy and migrate our sample application to get experience.

Migrating the application from Heroku to AWS

  1. Sign in to Qovery Console

  2. Create a new project

    Migrate from Heroku

  3. Create a new environment

    Migrate from Heroku

  4. Create a new application

    To follow the guide, you can fork and use our repository

    Use the forked repository (and branch master) while creating the application in the repository field:

    Migrate from Heroku

  5. Create and deploy a new database

    To learn how to do it, you can follow this guide

  6. Migrate PostgreSQL data

    There are multiple paths you could take to migrate your data from Heroku Postgres to AWS. For production usage for the shortest downtime you would probably want to configure PostgreSQL as a replica to the database on Heroku, and making it the primary instance after migration. Heroku does not support this in its free tier, so for the purpose of the example, we take a simpler path and use different tools to migrate the data.

    First, dump the data from your Heroku Postgres:

    heroku pg:backups:download -a YOUR_APPLICATION_NAME
    heroku pg:backups:capture -a YOUR_APPLICATION_NAME

    It results in creating a new latest.dump file, which you use to transfer data to AWS PostgreSQL.

    To migrate the data to your AWS PostgreSQL, run (replace all the values with secrets listed in your application Secrets tab):

    pg_restore -v -h $QOVERY_DATABASE_MY_POSTGRESQL_HOST -U $QOVERY_DATABASE_MY_POSTGRESQL_USER -d postgres latest.dump --no-owner

    Learn more about secrets here

Deploy your application

All you have to do now is to navigate to your application and click Deploy button

Deploy App

That's it. Watch the status and wait till the app is deployed.

After it's done, click on Action and Open button to navigate to your app. It should be up and running with all the data from Heroku migrated to AWS!

What's next

Setting Custom Domain
Using Multiple Environments