How can I migrate from an RDS for PostgreSQL to Aurora PostgreSQL?

Last updated: 2022-11-21

I want to migrate from an Amazon Relational Database Service (Amazon RDS) for PostgreSQL to Amazon Aurora PostgreSQL-Compatible Edition.

Short description

There are five options for migrating data from your existing Amazon RDS for PostgreSQL database to an Amazon Aurora PostgreSQL-Compatible DB cluster.

To migrate from Amazon RDS for PostgreSQL to Aurora PostgreSQL, use one of the following methods depending on your use case:

Resolution

Using a snapshot to migrate an RDS for PostgreSQL

To create an Aurora PostgreSQL DB cluster, you can migrate a DB snapshot of an RDS for PostgreSQL DB instance. The new Aurora PostgreSQL DB cluster is populated with the data from the original RDS for PostgreSQL DB instance. The RDS for PostgreSQL snapshot must use the same or a lower minor version as the Aurora PostgreSQL.

You can migrate the snapshot using the Amazon RDS console or AWS Command Line Interface (AWS CLI). For instructions, see Migrating a snapshot of an RDS for PostgreSQL DB instance to an Aurora PostgreSQL DB cluster.

Important:

Using an Aurora read replica to migrate an RDS for PostgreSQL

Use an RDS for PostgreSQL DB instance as the basis for a new Aurora PostgreSQL DB cluster by using an Aurora read replica. The Aurora read replica is available for migrating only within the same AWS Region and account. The Aurora read replica option minimizes downtime during a migration. You can promote the new cluster when you have zero (0) replication lag between the primary RDS instance and the Aurora read replica.

Creating an Aurora read replica using the Amazon RDS console is available only if the AWS Region offers a compatible Aurora PostgreSQL version. You can create an Aurora read replica for an RDS for PostgreSQL DB instance by using the Amazon RDS console or the AWS CLI. For instructions, see Migrating data from an RDS for PostgreSQL DB instance to an Aurora PostgreSQL DB cluster using an Aurora read replica.

Note: The source RDS for PostgreSQL must have sufficient storage capacity to retain the write-ahead logs (WAL) segments while the migration is occurring. For more information, see Preparing to migrate data by using an Aurora read replica.

Using a pg_dump utility to migrate an RDS for PostgreSQL

Pg_dump is a utility for backing up a PostgreSQL database. If your database size is small or you don't have downtime considerations, you can use this option. This method is best suited for migrating a few GB to 500-GB sized databases. Migrating larger databases might require higher outage depending on database size. Use an Amazon Elastic Compute Cloud (Amazon EC2) instance as the host within the same Availability Zone as the target database to mitigate network latency.

For instructions, see Importing a PostgreSQL database from an Amazon EC2 instance.

For additional pg_dump information, see the official PostgreSQL documentation.

Using logical replication to migrate an RDS for PostgreSQL

Amazon RDS for PostgreSQL and Aurora PostgreSQL aren't supported as targets for external PostgreSQL physical replication. However, logical replication is one way to reduce overall migration time. You can set a publisher and subscriber model between the RDS for PostgreSQL and Aurora PostgreSQL instance to migrate data with minimal downtime.

For more information, see Best practices for migrating PostgreSQL databases to Amazon RDS and Amazon Aurora and follow the instructions in Logical replication.

Using a data import from Amazon S3 to migrate an RDS for PostgreSQL

If your data is stored using Amazon Simple Storage Service (Amazon S3), you can migrate the data to an Aurora PostgreSQL DB cluster instance. For instructions, see Importing data from Amazon S3 into an Aurora PostgreSQL DB cluster.


Did this article help?


Do you need billing or technical support?