1

I have a heavy used RDS instance (MySQL) in EC2-Classic with three read replica instances. We're on plan to move some of our micro-services into VPC and some of them need to read on those replica instances (we have not plans to move completely those RDS instances to VPC in the medium term). The first thought that came to my mind was to create a read replica inside the VPC (I have already a subnet-group created), but I got an error message:

At least one security group 'xxxxx' (Non-VPC) and subnet group 'dbsubnetgroup' (in VPC 'vpc-123456') are not in common VPC. (Service: AmazonRDS; Status Code: 400; Error Code: InvalidParameterCombination; Request ID: 5a8f57fb-f5b4-11e5-996f-d16e3527730f)

I've tried to achieve this using the AWS CLI:

aws rds create-db-instance-read-replica --db-instance-identifier replica-name --source-db-instance-identifier spurce-name --db-subnet-group-name sbsubnetgroup-name --region us-east-1

A client error (DBSubnetGroupNotAllowedFault) occurred when calling the CreateDBInstanceReadReplica operation: DbSubnetGroupName should not be specified for read replicas that are created in the same region as the master

So, as far I see, this kind of replication is not allowed within the same region but it only works in a cross-region fashion?

Is there a way to solve it?

Thanks in advance

1

Yes, it works within the region, but within a region it doesn't work except within a single VPC.

There is something of a workaround, though.

Instead of creating a replica, you create a master. Load it with a dump from the original master, and then configure it yourself to replicate, temporarily, from the "external" master. There are stored procedures on every RDS instance to allow this to be done, since, lacking the SUPER privilege, it would otherwise be impossible.

See Replication with a MySQL or MariaDB Instance Running External to Amazon RDS.

You'll have to skip steps 1 and 4 and find another way to prevent all writes to your master while you get the dump file started, since RDS won't allow FLUSH TABLES WITH READ LOCK;.

  • Thanks, Michael. I've found in the rds_set_external_master docs that they don't recommend doing this between two RDS instances. Anyways, this is so odd since AWS allows this kind of replication between two continents but not within the same datacenter ¯_(ツ)_/¯ – Jose Peinado Mar 31 '16 at 22:09
  • Oh, you mean where it says Warning - Do not use mysql.rds_set_external_master to manage replication between two Amazon RDS DB instances. lol... The point, there, is that it isn't the correct way to set up a managed read replica in RDS... which does work within the same region, if the two machines are in the same VPC or both in EC2-Classic (in which case, RDS uses its own hidden back-end network, not "your" network for communication between the machines). – Michael - sqlbot Mar 31 '16 at 23:05
  • I suspect this is the only solution you'll find for your migration strategy --- and hot migration "into RDS" is what mysql.rds_set_external_master is really for. Of course you could also set up a MySQL server on an EC2 instance, then make it a slave of the classic machine, then make a new VPC RDS instance a slave of your stand-alone instance. :) – Michael - sqlbot Mar 31 '16 at 23:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.