-
Prepare your RDS instance and authorize access to it (basically make it public).
-
Put your app in maintenance mode:
heroku maintenance:on
-
Save the latest SQL dump of the DB:
psql -h HEROKU_DB_HOST -U HEROKU_DB_USER -d HEROKU_DB_NAME > latest.sql
If that fails (long time no response etc.), an alternate method is pulling to local first:
# Use DATABASE_URL literally heroku pg:pull DATABASE_URL awesome_project_production_local psql -d awesome_project_production_local > latest.sql
-
Upload the latest DB to RDS:
psql -h RDS_DB_HOST -U RDS_DB_USER -d RDS_DB_NAME < latest.sql
-
Remove your Postgres add-on from Heroku after making sure you have a backup, otherwise you will not be able to modify
DATABASE_URL
. -
Set your new
DATABASE_URL
:heroku config:set DATABASE_URL=postgres://RDS_DB_USER:RDS_DB_PASS@RDS_DB_HOST:5432/RDS_DB_NAME?sslmode=require
-
Get your app out of maintenance:
heroku maintenance:off
Move Heroku Postgres to Amazon AWS RDS
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was very helpful -- thank you!