Move postgres on EC2 to RDS in a different account

0

We have two separate accounts in different regions. My team works with the destination account and we want a database from source account which has PostgreSQL 11.5 standard Linux Ubuntu installation on EC2. In the destination we are RDS, so we want to essentially migrate from EC2 to RDS cross region and cross account. I know you can create a database in RDS from snapshot. I like that idea but can we create a database from the Postgres EC2 snapshot/data dump? If we can’t then what’s the best solution, the data size is 15 TB. And I have seen the migration from EC2 postgres dump to RDS postgres but I'm not sure if this can be done cross.

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL.Procedural.Importing.EC2.html

3 Answers
2

I can highly recommend the Database Migration Service, used it to migrate a production DB into RDS without any downtime. True black magic!

answered 2 years ago
  • Thanks, would that work cross account and cross region. Would there be any performance degradation while the transfer occurs? Also is there any extra storage involved?

1

Snapshot process works only for RDS not for a database running on EC2. You options are

  1. Use pg_dump/pg_restore into a new RDS instance
  2. Set up replication, either native logical replication or using DMS.
AWS
answered 2 years ago
  • Yes I understand that (the link I have posted says that). But my question what are the steps to make this work cross account and cross region.

  • Are you considering RDS PG or Aurora, because if you are considering Aurora, then it will be a bit easier, You can set up a local Aurora Cluster, restore into that, create a cross account clone (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.Managing.Clone.html#Aurora.Managing.Clone.Cross-Account) , convert this clone into a stand alone database and then convert into a global database. A bit involved process, but everything can be done easily using cli or gui. Other option is to set up replication( native or DMS) and you will have to set up network connectivity between your cross region VPCs

  • Are you considering RDS PG or Aurora, because if you are considering Aurora, then its a bit easy, set up a local Aurora Cluster, restore into that, create a cross account clone, convert this clone into a stand alone database and then convert into a global database. A bit involved process, but everything can be done easily using cli or gui. Other option is to set up replication( native or DMS) and you will have to set up network connectivity between your cross region VPCs, or simply take downtime, and do pg_dump/pg_restore

0

Hello,

--> DMS will be a good choice with minimal downtime. However it comes with some limitations. [+] https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.PostgreSQL.html#CHAP_Source.PostgreSQL.Limitations

--> native tool pg_dump and pg_restore will face downtime.

This is mentioned in [+] https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/migrate-an-on-premises-postgresql-database-to-amazon-rds-for-postgresql.html

--> DMS tutorials: https://aws.amazon.com/getting-started/hands-on/move-to-managed/migrate-postgresql-to-amazon-rds/

To answer your previous questions:

  1. It supports cross account cross region. As long as VPCs are communicating with each other. You may also migrating through internet. [+] https://docs.aws.amazon.com/dms/latest/userguide/CHAP_ReplicationInstance.VPC.html
  2. Using DMS Performance impact to the source should be minimal. Depends what are the task configurations such as (whether parallel-load during fullload, or some customers will create multiple tasks to migrate from source, then that will be causing some burden to the source)
  3. with pg_dump and pg_restore. You basically treat PostgreSQL on EC2 as on-prem. As long as you have one machine (Can be another EC2 or local machine) having access to EC2 and RDS. Follow the steps in [+] https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL.Procedural.Importing.EC2.html

Hope above helps.

AWS
SUPPORT ENGINEER
Kevin_Z
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions