This post gives a walkthrough on how to migrate an RDS DB across two AWS accounts.
#1 Take Snapshot
- Take a snapshot of the target DB
Go to AWS --> RDS --> Snapshots --> Take snapshot
#2 Create a KMS key
- Create a fresh KMS key and share it with the target account
AWS --> KMS --> Customer-managed keys --> create key
- Before you go on creating the new key, don't skip the above step. Now proceed to enter the target account ID in the below field
- Create a snapshot (a second) of the snapshot created in #1. The reasoning for this is that the KMS key created in #2 which was shared with the target account, was done to allow the creation of the DB on the target account
select the snapshot --> action --> copy snapshot
- While the steps to copying are underway, select the freshly created KMS key (I named it "test") from the drop-down
#3 Share the Snapshot
- Share the copied snapshot with the target account and enter the target account ID, once more
Select the snapshot --> Action --> share snapshot
NOTE: The below-proceeding steps should be executed on the target account
#4 Create a New DB.
- The shared DB snapshot will show up in your target account
Go to AWS --> RDS --> Snapshot --> Shared with me
- In the target account, create a new DB instance by restoring the DB snapshot
RDS --> Snapshot --> Shared with me --> select snapshot --> action --> restore snapshot.
NOTE: When creating a DB from the snapshot, DO NOT FORGET to swap the "test" KMS key with the "default" on the target account key. Select "(default) aws/rds"