In the previous article , I have explained How you can migrate EC2 Instance from One AWS account to Another , Refer here.
Let’s say you want to migrate the RDS Instance and you want to run your applications in another AWS account.
In this guide , We are going to see how we can migrate the existing RDS instances to another AWS account.
Sharing RDS Snapshots
- We can only share the manual snapshots of the RDS instance , Automated snasphots cannot be shared.
- The manual snapshots can be shared with up to 20 AWS accounts.
- The snapshot of the RDS instance which use custom option groups cannot be shared
Process of Sharing Snapshot to Another Account
In order to migrate RDS instance to another AWS account , We need to
- Create a manual snapshot of RDS instance
- Grant snapshot permission to Target AWS account
- Verity the snapshot
First we need to create a snapshot of the RDS instance , which is been explained here
Once the snapshot is created in the Source AWS account , We have to grant Snapshot permission to the Target AWS account so that the snapshot can shared.
Login to RDS Console , In the left navigation pane , Choose Snapshots
Select the snapshot of the RDS Instance which you need to migrate to the another aws account.
Under Actions , Click Share Snapshot
You will be taken to the following page.
Here We are going to add target AWS account.
Choose the DB snapshot visibility,
If you choose Public , It will allow all AWS accounts to restore a DB instance from the manual snapshot
If you choose Private , The manual snapshot will only be restored by the AWS account that I have explicitly granted permissions.
Provide an AWS account Number and then click Add.
You can repeat the same process to add maximum of 20 AWS accounts.Once done , Click Save.
Step 3 : Verification
Now Go to the target AWS account , Choose the Region from where the source AWS account shared the DB snapshot.
Login to RDS Console and then Choose Snapshots.
From the drop down menu , Choose Shared with Me
- Once the Snapshot is shared by source account , If the Source AWS account removes the Target AWS Account id from the Snapshot permission , The snapshot will automatically be deleted from the Target AWS account.Because the snapshot is still owned by the source AWS account.
- In order to avoid that , We need to Copy the snapshot to the same region or any other region in the target account.
- Also We can restore the RDS snapshot.
- To copy the snapshot , Choose the snapshot in the target account and Under Actions , select Copy snapshot
Select the destination region , and provide a name for the snapshot and then Click Copy snapshot
To Restore the RDS snapshot , Select the snapshot , Under Actions ,
Choose Restore snapshot.
Detailed process on how to restore the RDS DB snsoshot is explained here.
We have successfully migrated the RDS Instances from One AWS account to the Another , Also We have find a strategy to copy the snapshot and restore the snapshot.
Hope you find it helpful.Thanks for reading this article.
Check out my other articles.