
For example, when migrating from PostgreSQL 10 to PostgreSQL 11, use the pg_dump and pg_restore utilities of PostgreSQL 11.
For migrating to a higher version of PostgreSQL, we recommend using a higher version of pg_dump and pg_restore. You can find these options by entering pg_dump -help and pg_restore -help commands. Using some of the pg_dump and pg_restore process options can result in faster migration. Next, we discuss some of the tips that can help reduce the migration time using pg_dump, pg_restore, and psql utilities pg_dump and pg_restore options Migrating bigger databases may require higher outage depending on database size. This method is best suited for migrating a few GB to 500 GB sized databases. Depending on the format, you can restore dump files with the psql program or by another PostgreSQL utility, pg_restore.
#Aws postgresql dump ec2 upgrade#
This utility is commonly used for logical dumping data for migration or upgrade purposes. Feeding this file to a server recreates the database in the same state as it was at the time of the dump. Pg_dump is a PostgreSQL native utility to generate a file with SQL commands. PostgreSQL native utility: pg_dump and pg_restore For more information, see Amazon RDS for PostgreSQL Pricing or Amazon Aurora Pricing, respectively. Running an RDS or Aurora PostgreSQL instance incurs cost.
Issue the migration commands at the target instance using the rds_superuser role. Provision a target RDS for PostgreSQL database or Amazon PostgreSQL database. To avoid any access issues, run the migration commands as a superuser role at the source side. To apply the best practices for migration, you need to have a source database up and in a Running state. The following diagram compares the various PostgreSQL native migrations strategies to migrate Amazon RDS for PostgreSQL or Aurora PostgreSQL.īefore getting started, complete the following prerequisites: You should use the COPY command to migrate filtered table data. To minimize downtime, logical replication is the better solution. If downtime during migration is affordable, using pg_dump and pg_restore is the preferred method. These practices are useful for migrating PostgreSQL databases from on-premises servers, Amazon Elastic Compute Cloud (Amazon EC2) instances, or from one RDS or Aurora instance to another. In this post, we provide some best practices for migrating PostgreSQL databases to Amazon RDS for PostgreSQL and Aurora PostgreSQL using PostgreSQL native tools such as pg_dump and pg_restore, logical replication, and the COPY command. Migrating to RDS for PostgreSQL or Aurora PostgreSQL clusters requires strategy, resources, and downtime maintenance. The post discusses best practices and solutions for some of the limitations when using PostgreSQL native utilities to migrate PostgreSQL databases to Amazon RDS for PostgreSQL or Aurora PostgreSQL. AWS offers Amazon Relational Database Service (Amazon RDS) for PostgreSQL and Amazon Aurora PostgreSQL-Compatible Edition as fully managed PostgreSQL database services. For many organizations, PostgreSQL is the open-source database of choice when migrating from commercial databases such as Oracle or Microsoft SQL Server. From a few GB to multi-TB databases, PostgreSQL is best suited for online transaction processing (OLTP) workloads. PostgreSQL is one of the most advanced open-source relational database systems.