How to migrate your Heroku Postgres database to Amazon RDS

How to migrate your Heroku Postgres database to Amazon RDS

After created RDS database

Add RDS certificate to your application:

$ cd your_app

$ mkdir -p config

$ curl https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem > ./config/rds-combined-ca-bundle.pem

$ git add config/rds-combined-ca-bundle.pem

$ git commit -m "Add RDS certificate to app files"

$ git push heroku master

Dump your Heroku database locally

This will take your application offline.

$ cd your_app

$ heroku maintenance:on


$ heroku pg:backups capture


$ curl -o /tmp/latest.dump `heroku pg:backups public-url`

Switch the Heroku app to RDS

heroku addons:destroy heroku-postgresql

heroku config:add DATABASE_URL='postgres://rohit:rohit00$$@blogger.cvss58cdh1jm.us-east-1.rds.amazonaws.com:5432/blogger?sslca=config/rds-combined-ca-bundle.pem&sslmode=require&encrypt=true'

Syntax;

heroku config:add DATABASE_URL='postgres://myrdsusername:myrdspassword@my-instance.bdfsg3dsfg.ap-southeast-2.rds.amazonaws.com:5432/my_db_production?sslca=config/ca/rds-ssl-ca-cert.pem&sslmode=require&encrypt=true'

This will take your application online.

heroku maintenance:off


Comments

Popular posts from this blog

psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

E: Package 'aptitude' has no installation candidate

CARRIERWAVE - UPLOAD ANY MEDIA (AUDIO , VIDEO AND IMAGE ) FILE IN RAILS

SEARCHING USING AJAX IN RAILS

SELECT COUNTRY WITH STATE AND IT'S CITIES RAILS

RAILS: UPLOADING PHOTOS VIA AMAZON S3 AND PAPERCLIP (UPLOADING FILES TO S3 IN RUBY WITH PAPERCLIP)

CHECK PASSENGER RUBY PATH

CURL COMMAND ON RUBY ON RAILS

SHOW LINE NUMBER OF TEXT AREA