I have a master MySQL instance running on our local network, but I was wondering if I can get an EC2 RDS instance to replicate the master or is this locked down by amazon?
Apparently this is now possible, however it is not fully "supported". Amazon will now allow you to replicate an RDS to an external slave, and replicate to an RDS from an external master, however their disclaimer suggests that they don't intend for this to be a permanent part of your server setup.
I have personally not tested this, but I plan on using it to help migrate off of some old non-AWS servers in which I host various databases and applications.
Given your question the below AWS doc will best apply.
Replication to RDS from external Master: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MySQL.Procedural.Importing.NonRDSRepl.html
Proof of concept on Sönke Ruempler's blog post (RDS to External Slave): http://www.ruempler.eu/2013/07/07/replicating-aws-rds-mysql-databases-to-external-slaves/
This is still not supported as of February 2011, see RDS instance as a replication slave:
Non-RDS to RDS replication is not currently supported [...]. However, we will log your interest for our future road map planning.
You can do this with Tungsten Replicator, which is an open source replacement for MySQL native replication. It now supports replication from a MySQL master to an Amazon RDS slave. For more information, please see the following blog article:
Cheers, Robert Hodges (Tungsten committer)
This is now officially supported. In addition to John C's link (http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MySQL.Procedural.Importing.NonRDSRepl.html), AWS created a (lengthy) webcast about it as well: http://youtu.be/TT1M_XRAlQo
I won't fully reproduce the AWS documentation, but the abbreviated steps are:
- Create RDS instance that will act as slave (either MySQL 5.5 version 5.5.33 or later, or MySQL 5.6 version 5.6.13 or later)
- Edit the RDS security group to authorized the the IP address of your external master
- If the external master is an EC2 machine, update that machine's security group to allow inbound and outbound connections to your RDS IP address over TCP 3306
- Set the server variables on the external master and the RDS slave to allow replication (e.g., log-bin, server-id, etc.; beyond the scope of this question)
- Create a replicant user on the external master
- Run your mysqldump on the external master
- Run head dump.sql -n80 | grep "MASTER_LOG_POS" to get the MASTER_LOG_FILE and MASTER_LOG_POS values
mysql -u[RDS username] -h'[RDS IP address]' -p'[password]' < ~/dump.sql
- Once the dump file is loaded into the RDS machine, you can't run the same types of commands that you would run in standard MySQL to set up the replication variables, so instead you log into mysql on the RDS instance and run
mysql> CALL mysql.rds_set_external_master ('[external master ip]', 3306, '[replicant username form step 5]', '[replicant password]' , '[MASTER_LOG_FILE value from step 7, e.g., mysql-bin.000042]', [MASTER_LOG_POS value from step 7 e.g., 107] , 1);
mysql> call mysql.rds_start_replication;
Unfortunately not currently supported by Amazon. Hopefully in the future as I am awaiting that ability too.
We are excited to announce the release of Read Replicas for Amazon RDS. You can now create one or more replicas of a given “source” DB Instance and serve incoming read traffic from multiple copies of your data. This new database deployment option enables you to elastically scale out beyond the capacity constraints of a single DB Instance for read-heavy database workloads. You can use Read Replicas in conjunction with Multi-AZ replication for scalable, reliable, and highly available production database deployments. To learn more about the release of Read Replicas, please visit the forum post here.
In addition to the release of Read Replicas, we have also lowered the On-Demand and Reserved prices for High Memory Double Extra Large (m2.2xlarge) and Quadruple Extra Large (m2.4xlarge) DB Instances. See the pricing section of the Amazon RDS detail page for full details.