The following steps will get you there, too.
- Signup for Amazon RDS
- Download the Amazon RDS Command Line Toolkit
- Install the Toolkit
- Unpack toolkit. I did this in /Users/phertler/Applications/RDSCli-1.3.003
- export AWS_RDS_HOME=/Users/phertler/Applications/RDSCli-1.3.003
- Make sure you JAVA_HOME is set. export JAVA_HOME=/Library/Java/Home
- Configure credentials
- cp $AWS_RDS_HOME/credential-file-path.template $AWS_RDS_HOME/credential-file.txt
- Update credential-file.txt with your Amazon Account credentials
- Create a security group for your database
- rds-create-db-security-group --db-security-group-name mygroupname --db-security-group-description 'my database security group'
- Launch a RDS instance with an instance named myinstance database named mytestdb. Be sure to remember your username and password.
- Allow current local machine to connect to your new mysql database
- rds-authorize-db-security-group-ingress --db-security-group-name mygroupname -i
/32 - List your instances to be sure you can connect
- rds-describe-db-instances
- Now you can connect to your database from you local machine. You will need to find your RDS instance's endpoint from the AWS console. It will look something like myinstance.clxktpjkersojt.us-east-1.rds.amazonaws.com
- mysql -h myinstance.clxktpjkersojt.us-east-1.rds.amazonaws.com -u yourusername -p
Now you are ready to migrate your heroku database to RDS
- Allow heroku to connect to your RDS instance
- rds-authorize-db-security-group-ingress default --ec2-security-group-name database --ec2-security-group-owner-id 098166147350
- Add the heroku rds addon
- heroku addons:add amazon_rds url=mysql://user:pass@rdshostname.amazonaws.com/databasename
- Port your current Heroku Postgres database to your new Amazon RDS MySQL database
- heroku db:pull mysql://user:pw@myinstance.clxktpjkersojt.us-east-1.rds.amazonaws.com/mytestdb
Finished!.....well, now you can also set up the Read Replica and then set up a Master/Slave database with https://github.com/plaxis/multi_db
No comments:
Post a Comment