How can I make a copy of a DB instance to use as a test/sandbox DB in AWS?

634 views Asked by At

I have multiple questions about this issue since AWS is still new to me.

What I am trying to accomplish: I want to create a test/sandbox db for my live db instance. I want to do this to create a sandbox environment for my developers, so they can add, edit, delete whatever they want on the test db without effecting the companies live db that's being used for our site.

Specifications: I want my test db to be continually updated alongside my live db. So I want a parent and child relationship or master/slave. So basically whatever the master has the slave will have but the slave cannot edit the master in any way whatsoever. Also I want the slave to have a different security group than the masters.

Things I have tried: first I thought I could copy a db snapshot of my live db and transfer it to a new db instance. But how would the new instance be continually updated. I couldn't even find what to do with the copied snapshot so that was a dead end. Then I read that I could create a read replica of my master db, so I did that, I promoted it as per the documentation. Now can I read and write to this replica? Is this the correct path for what I want? Can I assign the replica a different security group from the master? And will the replica get updated data from master?

Is what I'm asking possible? Could someone please explain to me what the correct course of action is here or if I'm going about it incorrectly. Again a bit lost as I'm new to AWS, any help would be greatly appreciated! :)

Documentation for reference: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ReadRepl.html http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_CopySnapshot.html

1

There are 1 answers

5
Sergey Kovalev On

Not possible with RDS. Either you use replication (and can't write to replica) or make a clone that will not update.

You can, however, setup you own MySQL/MariaDB master-slave configuration and write to slave. Should work fine as long as you don't have conflicting values in indexes (usually because of autoincrementing primary key).