Home > front end >  how to migrate clustered rds(postgres) to different account?
how to migrate clustered rds(postgres) to different account?

Time:02-14

I am migrating from AccountA(source) to AccountB(Target), same region. I ran templates so AccountB already has a RDS cluster but with no data. The db instance id is exactly same as what I have on the sourcing account.

**My goal is to have the same endpoint as before since we're retiring AccountA completely and I don't want to change codes side for the updated endpoint. **

I took a snapshot of the cluster(writer instance) then copy snapshot with a KMS key, shared it with AccountB. All good. Now, from the AccountB(target), copied snapshot and attempted to restore. I thought I could restore directly into the RDS cluster but I see that's not doable with restore as it always creates a new instance.

Then, I renamed the existing empty RDS cluster to something else to free up the DB instance ID, then renamed the temp cluster to the same name. It worked but this seems not efficient.

What's is the best practice for the RDS data migration ?

  • Clustered RDS ( writer - reader ) and Cross Account
  • I didn't create a snapshot for Reader. Will it be synced from the writer automatically once I restore?

CodePudding user response:

Your experience is correct -- RDS Snapshots are restored as a new RDS instance (rather than loading data into an existing instance).

By "endpoint", if you are referring to the DNS Name used to connect to the database, then the new database will not have the same endpoint. If you want to preserve an endpoint, then you can create a DNS Name with a CNAME record that resolves to the DNS Name of the database. That way, you can change the CNAME record to point to a different endpoint without needing to change the code. (However, you probably haven't done this, so you'll need to change the code to point to the new DNS Name anyway, so it's the same amount of work.)

You are correct that you do not need to snapshot/copy the Readers -- you can simply create them from the new database. You will need to 'create' the Readers on the new database after the restore, since the Snapshot simply contains data for the main database.

  • Related