Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon RDS Read Replica in Same Region, Different VPC

For version cut-over, I am using CloudFormation to spin up a new infrastructure with a new VPC, Subnets, and Security Groups. I want a copy of my production database in the new VPC (same region). I do not want to use a Snapshot, because that would require me to take the app down for a while (after the snapshot is taken, any new data will be lost, so I have to shut down the app).

I want to create a read-replica into the new VPC/SecurityGroup/Subnets, and then when I am ready for cut-over I will promote that read replica. Is this possible?

AWS documentation gives clues that creating a read replica across VPCs in the same region is not supported, but does not explicitly say so. Alternately, I am open to moving the database after promotion.

Thanks

P.S. example of what I mean by "clue": "Within a region, all cross-region replicas created from the same source DB instance must either be in the same Amazon VPC or be outside of a VPC." http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ReadRepl.html This almost answers my question... But what about replicas created in the same region as the source DB?

like image 594
uri.shatil Avatar asked Jul 14 '14 21:07

uri.shatil


2 Answers

It is not supported.

You can do a read replica within the same VPC, then take a snapshot of the replica and restore it on the other VPC.

like image 72
Ben Whaley Avatar answered Oct 20 '22 09:10

Ben Whaley


You can actually do this using external MySQL replicas. You will need appropriate routing and security groups between your VPCs. As long as your VPC subnets can communicate with each other, create a replica, stop replication on it and record the binlog position info where it was stopped. Take a snapshot of the replica and use that to spin up a new RDS instance in the new VPC, now set the external replica to your old RDS instance and start replicating where the binlog position was recorded. You've now got a master RDS instance in your new VPC, replicating from the old VPC.

This article covers it in easy to follow steps:

http://quiddle.net/post/78453641455/migrating-rds-from-ec2-to-vpc

like image 40
d11wtq Avatar answered Oct 20 '22 10:10

d11wtq