Search code examples
postgresqlamazon-rdsdatabase-migrationaws-dmsamazon-aurora

Can you use AWS DMS to move Aurora DB from one account to another?


I am trying to migrate an Aurora cluster from one of our accounts to another. We actually do not have a lot write requests and the database itself is quite small, but somehow we decided to minimize the downtime.

I have looked into several options

  1. Use snapshot: cut off the mutation in source DB, take snapshot, share and restore in another account. This would definitely introduce some downtime
  2. Use Aurora cloning: cut off the mutation in source DB, clone the cluster in target account and switch to the target DB. According to AWS, the cloning is much faster than taking and restoring a snapshot, so the downtime should be shorter.
  3. I am not sure if I can use DMS to do this as I did not find useful doc/tutorials about moving Aurora across accounts. Also, I am not sure whether DMS will sync any write requests to target DB during migration.
  4. If DMS can not live sync, then I probably should use Bucardo to live migrate.

Solution

  • We actually ended up using DMS for this migration. What we did was:

    1. Take a snapshot of the target DB in the original account.
    2. Share the snapshot to the target account and restore it over there. (You have to use snapshot for migrating things like triggers, custom types, sequence, etc)
    3. Setup connections (like VPC peering or security groups) between two accounts.
    4. Setup DMS in source account (endpoints, replication instance, task)
    5. Write SQL to temporarily disable/delete constraints, triggers, etc which may cause error when load source data.
    6. Using DMS to load source data and enable ongoing replication.
    7. Enable/add constraints, triggers, etc back.
    8. Post migration test