DEV Community

Selvakumar for itTrident Software Services

Posted on • Edited on

Migrate RDS Cross-Account

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
Enter fullscreen mode Exit fullscreen mode

Image description

#2 Create a KMS key

  • Create a fresh KMS key and share it with the target account
AWS --> KMS --> Customer-managed keys --> create key
Enter fullscreen mode Exit fullscreen mode
  • 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

Image description

  • 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
Enter fullscreen mode Exit fullscreen mode
  • While the steps to copying are underway, select the freshly created KMS key (I named it "test") from the drop-down

Image description

#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
Enter fullscreen mode Exit fullscreen mode

Image description

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
Enter fullscreen mode Exit fullscreen mode

Image description

  • In the target account, create a new DB instance by restoring the DB snapshot
RDS --> Snapshot --> Shared with me --> select snapshot --> action -->  restore snapshot.
Enter fullscreen mode Exit fullscreen mode

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"

Image description

Top comments (0)