Most projects don’t start out knowing exactly how their infrastructure will turn out. That is one of the reasons I like infrastructure-as-code, but when it comes to data (as in databases), it’s a whole other ball game. Actually, I believe that Cloud’s don’t lock us in with their services, they lock us in once our data is there. Data is hard to move, particularly now that we collect so much of it and often have to convert between systems.
Recently I had a request from a client that needed to merge two Oracle instances into one for cost savings. I’m not going to cover that here (let’s just say Oracle is a beast of its own). But to try out AWS’s Data Migration Service (DMS) to see if it was a fit, I tested it with two MySQL instances.
Here’s what you’d need to do:
If everything works out, the initial copy will be done pretty queckly and DMS enters replication mode, so any change on a source instance will show up on the target instance pretty much immediately.
Bonus
In case you need to rename a given schema you can use the guided version or a JSON mapping like below (e.g. renaming Test
to Test1
:
{
"rules": [
{
"rule-type": "selection",
"rule-id": "1",
"rule-name": "1",
"object-locator": {
"schema-name": "Test",
"table-name": "%"
},
"rule-action": "include"
},
{
"rule-type": "transformation",
"rule-id": "2",
"rule-name": "2",
"rule-action": "rename",
"rule-target": "schema",
"object-locator": {
"schema-name": "Test"
},
"value": "Test1"
}
]
}
I hope this helps!