ddd
ddd

Reputation: 5029

How do I move data from RDS of one AWS account to another account

We have our web services and database set up on AWS a while back and application is now in production. For some reason, we need to terminate the old AWS and move everything under a newly created AWS account. Application and all the infrastructure are pretty straightforward. It is trickier for data though. The current database is still receiving lots of data on daily basis. So it is best to migrate the data after we turn off the old application and switch on new platform.

Both source RDS and target RDS are Postgres. We have about 40GB data to transfer. There are three approaches I could think of and they all have drawbacks.

  1. Take a snapshot of the first RDS and restore it in second one. Problem is I don't need to transfer all the data from source to destination. Probably just records after 10/01 is enough. Also snapshot works best to restore in an empty rds that is just created. For our case, the new RDS will start receiving data already after the cutoff. Only after that, the data will be transferred from old account to new account otherwise we will lose data.
  2. Dump data from tables in old RDS and backup in new RDS. This will have the same problem as #1. Also, if I dump data to local machine and then back up from local, the network speed is bottleneck.
  3. Export table data to csv files and import to new RDS. The advantage is this method allows pick and choose and some data cleaning as well. But it takes forever to export a big fact table to local csv file. Another problem is, for some of the tables, I have surrogate row IDs which are serial (auto-incremental). The row IDs of exported csv may conflicting with existing data in new RDS tables.

I wonder if there is a better way to do it. Maybe some ETL tool AWS has which does point to point direct transfer without involving using local computer as the middle point.

Upvotes: 5

Views: 12820

Answers (2)

asktomsk
asktomsk

Reputation: 2298

In 2022 the simplest way to achieve this task is using AWS Database Migration Services (AWS DMS).

You can create a migration task, and set the original database as the source endpoint, and the new database as a destination endpoint.

Next create a task with "Full load, ongoing replication" settings.

More details here: https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.PostgreSQL.html

Upvotes: 2

logesh
logesh

Reputation: 2662

I have recently moved the data of RDS from one account to other using Bucardo (https://bucardo.org/). Please refer the following blogs

https://www.compose.com/articles/using-bucardo-5-3-to-migrate-a-live-postgresql-database/

https://bucardo.org/pipermail/bucardo-general/2017-February/002875.html

Though this has not mentioned exactly about migration between two RDS account, this could help setting things. We still need some intermediate point such as EC2 instance where we need to configure this Bucardo and migrate the data between accounts. If you are looking for more information, I am happy to help.

In short, we need to take a manual snapshot of the source db and restore it in the another account (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ShareSnapshot.html) and with Bucardo set up in the EC2 instance, we can start to sync the data using triggers and that will update the data in destination db as and then the new data comes in to the source DB.

Upvotes: 0

Related Questions