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

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

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

SELECT COUNTRY WITH STATE AND IT'S CITIES RAILS

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"?

SEARCHING USING AJAX IN RAILS

UNINITIALIZED CONSTANT PAPERCLIP::STORAGE::S3::AWS

UPLOAD ANY MEDIA FILE IN RAILS USING PAPERCLIP

Building native extensions. This could take a while... ERROR: Error installing mysql: ERROR: Failed to build gem native extension.

HOW TO CALL RAILS API FROM SIMPLE HTML PAGE.