How to Migrate an RDS Database to Another AWS Account💡

Gerlyn MGerlyn M
4 min read

Migrating an Amazon RDS (Relational Database Service) instance from one AWS account to another is a bit different from migrating an EC2 instance. Unlike EC2, RDS is a managed service, and you can't directly "Create AMI and give permission to destination account" like we did for EC2 instance. However, you can achieve the migration using snapshots and sharing capabilities.


Step 1: Create a Manual Snapshot of the RDS Instance 📸

  1. Go to the RDS Dashboard in the source AWS account.

  2. Select the RDS instance you want to migrate.

  3. Click Actions > Take Snapshot.

  4. Provide a name for the snapshot and confirm.

    Note: Creating a snapshot may take some time, depending on the size of your database.


Step 2: Share the Snapshot with the Destination AWS Account ⏩

  1. Once the snapshot is created, go to the Snapshots section in the RDS Dashboard.

  2. Select the snapshot you just created.

  3. Click Actions > Share Snapshot.

  4. Enter the AWS Account ID of the destination account.

  5. Click Save to share the snapshot.


Step 3: Copy the Snapshot to the Destination Account ☕

  1. Log in to the destination AWS account.

  2. Go to the RDS Dashboard > Snapshots.

  3. Look for the shared snapshot in Shared with Me section.

  4. Select the snapshot and click Actions > Copy Snapshot.

  5. Choose the destination region (if different) and provide a name for the copied snapshot.

  6. Click Copy Snapshot.

    Note: Copying the snapshot may take some time, depending on the size of the database and the region.


Step 4: Restore the RDS Instance in the Destination Account 🔁🗺️

  1. Once the snapshot is copied, select it and click Actions > Restore Snapshot.

  2. Configure the new RDS instance:

    • Set the DB identifier name.

    • Set the DB instance size, storage type, and other settings.

    • Configure networking (VPC, subnet group, security group).

  3. Click Restore DB Instance.

    Note: The restored RDS instance will have the same data as the original database but will be a new instance in the destination account.


Step 5: Verify and Clean Up ✅🧹

  1. Verify the New RDS Instance:

    • Log in to the new RDS instance and ensure all data and configurations are correct.

    • Test the connection to the database from your application or client tools.

  2. Clean Up:

    • Delete the shared snapshot from the source account if it’s no longer needed.

    • Terminate the original RDS instance in the source account (if no longer required).


Important Considerations: 🛑‼️

  1. Downtime:

    • During the migration, the original RDS instance remains operational. However, any changes made to the database after the snapshot was taken will not be included in the migrated instance. Plan accordingly to minimize data loss.
  2. Automated Backups:

    • If automated backups are enabled for the RDS instance, ensure you have a recent backup before starting the migration.
  3. IAM Permissions:

    • Ensure both AWS accounts have the necessary IAM permissions to share and access snapshots.
  4. Cross-Region Migration:

    • If you’re migrating the RDS instance to a different region, you’ll need to copy the snapshot to the new region before restoring it.
  5. Encryption:

    • If your RDS instance is encrypted, ensure the destination account has access to the encryption key (KMS key). You may need to share or recreate the key in the destination account.

Pro Tip: 🚀

If you want to minimize downtime or migrate a live database, you can use AWS Database Migration Service (DMS). DMS allows you to replicate data from the source RDS instance to the destination RDS instance in near real-time. This approach is more complex but ideal for large databases or zero-downtime migrations.


Conclusion: 🎃

Migrating an RDS database to another AWS account is straightforward if you follow the snapshot and sharing process. While it requires some planning, the steps are simple and ensure your data remains intact. For more advanced use cases, consider using AWS DMS for a seamless migration.


📬Need help with your RDS migration? Drop a comment below or reach out for more tips on managing your AWS resources! 🚀

11
Subscribe to my newsletter

Read articles from Gerlyn M directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Gerlyn M
Gerlyn M

Gerlyn is a DevOps engineer with a strong passion for Kubernetes and automation. He is always eager to learn and continuously strives to enhance his skills, aiming to become an expert in the field. He loves to share his knowledge with the community.