Migrate your application from Heroku to AWS

Guide on how to migrate all your applications from Heroku to AWS with your databases

This guide describes how to migrate your application running on Heroku to AWS with Qovery. 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.

Please contact us via our forum if you experience any problem while migrating from Heroku to AWS with Qovery.

Migration Steps

  1. Use Buildpacks or Create your Dockerfile
  2. Create resources on Qovery
  3. Configure Environment Variables and Secrets
  4. Copy data from your Heroku databases to your AWS databases
  5. Deploy your apps
  6. FAQ by Heroku users

1. Create your Dockerfile or Use Buildpacks

Qovery supports two ways to build and run your application coming from Heroku:

  1. Buildpacks
  2. Docker

Both options build a container image that is runnable by a container engine (E.g. Docker). Qovery runs containers on Kubernetes.

Choose the option that better fits you:

Buildpacks automatically detects the language and the framework your application is using. Buildpacks builds and runs your app. Here is the list of supported languages and frameworks.

Limitations

Here are some limitations due to our Buildpacks implementation:

  • Qovery Buildpacks does not support Procfile with multiple commands at the moment.
  • Qovery does not support custom Buildpacks.

Those limitations will be solved in the coming months.

2. Create resources on Qovery

Application

Steps:

  1. Connect to the Qovery console.
  2. Create your Organization and your Project.
  3. Create an environment with the name production (it can be changed after).
  4. Create an application and give it a name (you can give the name of your repo if you have no idea)
  5. Select your app repository from your GitHub, GitLab or Bitbucket.
  6. Select the branch you want to deploy.
  7. Select the Build mode for Buildpacks or Dockerfile according to what you want.
  8. Specify the local listening port of your application.
  9. Click on "create"

Congrats! Your application is created 🎉

If you deploy an app from a mono-repository, we have a must-read guide for you here.

Database

Here are the steps to deploy your database:

Steps:

  1. Go to your production environment.
  2. Add your database by clicking on "Add" > "Database".
  3. Select the database (PostgreSQL, MySQL, MongoDB, Redis..) and the version you want to deploy.
  4. Select Managed or Container mode for your database.
  5. Select Public accessibility (set Private if you don't want to restore your data from an existing Heroku database).

Congrats! Your database is created as well 🎉

If you use MongoDB Atlas, or an existing database on AWS that you want to connect to your application deployed by Qovery. Check out our tutorial about VPC peering and how to securely connect to your existing database.

3. Configure your Environment Variables and Secrets

Qovery makes the difference between an environment variable and a secret. Basically, a Secret is similar to an Environment Variable but the value is encrypted and can't be revealed. Both are injected as environment variables during the build and the run of your applications. More info here

To extract your environment variables from Heroku, we recommend using the Heroku CLI and exporting all the environment variables and secrets in an .env (dot env) file. Qovery supports the import of a dot env file via the Qovery web interface and the Qovery CLI.

Export your environment variable via the Heroku CLI with the command:

# To install Heroku CLI: https://devcenter.heroku.com/articles/heroku-cli
heroku config
GREETINGS: hello world
STRIPE_API_KEY: xxx-yyy-zzz
IS_PRODUCTION: true

Then you can create your environment variables via the web interface (watch the video below)

Or via the Qovery CLI:

Import Heroku environment variables with the Qovery CLI
# auth yourself
qovery auth
# selection the app where you want to import your environment variables
qovery context set
# import your Heroku environment variables
heroku config --app <your_heroku_app_name> --json | \
qovery env parse --heroku-json > heroku.env && \
qovery env import heroku.env && \
rm heroku.env
Qovery: dot env file to import: 'heroku.env'
? Do you want to import Environment Variables or Secrets? Environment Variables
? What environment variables do you want to import? [Use arrows to move, space to select, <right> to all, <left> to none, type to filter]
[x] GREETINGS=hello world
[ ] STRIPE_API_KEY=xxx-yyy-zzz
> [x] IS_PRODUCTION=true
Qovery: ✅ Environment Variables successfully imported!

Connect your frontend app to your backend app

To connect your frontend app your backend app we will create an environment variable alias.

Here is how to create a frontend app:

And now how to connect your frontend app with your backend app:

You can also take a look at this forum reply to learn how to do it.

Connect your backend app to your database

Same as connecting your frontend app to your backend app, you can create an environment variable alias DATABASE_URL for the built-in secret finishing with _DATABASE_URL_INTERNAL.

4. Copy data from your Heroku databases to your AWS databases

Coming soon with Replibyte

5. Deploy your apps!

We are finally ready to deploy my applications on AWS!

Watch the final result 😎

FAQ by Heroku users

How to create a custom domain?

Check out the documentation on how to configure your custom domain.

How to monitor my apps?

We do recommend using Datadog or any other monitoring products for monitoring your apps deployed by Qovery. Check out our tutorial on how to install Datadog.

Do you have Heroku "Review App" equivalent?

Yes, it's what we call Preview Environment

How to rollback?

Check out the app rollback documentation

How auto-scaling works?

Check out the app auto-scaling documentation

How to manage database migration?

Check out our forum reply

Is it possible to get a shell / connect to my app?

Yes, with the Qovery CLI and the command qovery shell. Check out the documentation.

Can I use Terraform and Infrastructure as Code?

Absolutely, we have a Qovery Terraform provider available.

How can I connect my app to MongoDB Atlas?

If you use MongoDB Atlas check out our tutorial about VPC peering and how to securely connect to your existing MongoDB Atlas database.

How can I connect my app to an AWS service not managed by Qovery?

If you want to connect your app to an AWS service not managed by Qovery, check out our tutorial about VPC peering and how to securely connect to this AWS service.


If you have a common question about Qovery, we have a more general FAQ section available.

Wrapping up

Congrats! You have migrated from Heroku to AWS. Feel free to check out our forum and open a thread if you have any question.