Migrate an on-premises PostgreSQL database to Amazon RDS for PostgreSQL - AWS Prescriptive Guidance

Migrate an on-premises PostgreSQL database to Amazon RDS for PostgreSQL

Created by Sergey Dmitriev (AWS)

R Type: Replatform

Source: Databases: Relational

Target: Amazon RDS for PostgreSQL

Created by: AWS

Environment: PoC or pilot

Technologies: Databases; Migration

Workload: Open-source

AWS services: Amazon RDS

Summary

This pattern walks you through the steps for migrating an on-premises PostgreSQL source database to Amazon Relational Database Service (Amazon RDS) for PostgreSQL. The pattern includes two migration options: using AWS Data Migration Service (AWS DMS) or using native PostgreSQL tools such as pg_dump, pg_restore, and psql, or third-party tools.

Prerequisites and limitations

Prerequisites

  • An active AWS account

  • A PostgreSQL source database in an on-premises data center

Limitations

  • Database size limit: 64 TB

Product versions

Architecture

Source technology stack

  • An on-premises PostgreSQL database

Target technology stack

  • An Amazon RDS for PostgreSQL database (same PostgreSQL version as the source database)

Target architecture

Data migration architecture

Using AWS DMS:

Using native PostgreSQL or third-party tools:

Tools

  • AWS DMSAWS Data Migration Service (AWS DMS) supports several different source and target databases. See Using a PostgreSQL Database as a Source for AWS DMS in the AWS DMS documentation for a list of supported PostgreSQL source and target database versions and editions. We recommend that you use the latest version of AWS DMS for the most comprehensive version and feature support.

  • Native PostgreSQL tools – These include pg_dump, pg_restore, and psql.

Epics

Task Description Skills required
Validate the source and target database version and engine.

DBA
Identify hardware requirements for the target server instance.

DBA, SysAdmin
Identify storage requirements: storage type and capacity.

DBA, SysAdmin
Choose proper instance type capacity, storage features, and network features.

DBA, SysAdmin
Identify network access security requirements for source and target databases.

DBA, SysAdmin
Identify the application migration strategy.

DBA, SysAdmin, App owner
Task Description Skills required
Create a virtual private cloud (VPC).

SysAdmin
Create security groups.

SysAdmin
Configure and start an Amazon RDS DB instance.

SysAdmin
Task Description Skills required
Use native PostgreSQL tools or third-party tools to migrate database objects and data.

We recommend that you use native PostgreSQL database migration tools under the following conditions: you have a homogeneous migration, where you are migrating from a database with the same database engine as the target database; you are migrating an entire database; and the native tools allow you to migrate your system with minimal downtime.

DBA
Task Description Skills required
Migrate data with AWS DMS.

In most cases not listed under the first option, performing a database migration using AWS DMS is the best approach. AWS DMS can migrate databases without downtime and, for many database engines, continue ongoing replication until you are ready to switch over to the target database. You can migrate to either the same database engine or a different database engine using AWS DMS. We recommend that you use the latest version of AWS DMS for the most comprehensive version and feature support.

DBA
Task Description Skills required
Follow your chosen application migration strategy.

DBA, SysAdmin, App owner
Task Description Skills required
Switch over application clients to the new infrastructure.

DBA, SysAdmin, App owner
Task Description Skills required
Shut down temporary AWS resources.

DBA, SysAdmin
Review and validate project documents.

DBA, SysAdmin, App owner
Gather metrics detailing time to migrate, percentage of manual versus tool operations, cost savings, etc.

DBA, SysAdmin, App owner
Close out the project and provide any feedback.

Migration Lead, App owner

References

Tutorial and videos