Migrating data from PostgreSQL databases with homogeneous data migrations in Amazon DMS - Amazon Database Migration Service
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Migrating data from PostgreSQL databases with homogeneous data migrations in Amazon DMS

You can use Homogeneous data migrations to migrate a self-managed PostgreSQL database to RDS for PostgreSQL or Aurora PostgreSQL. Amazon DMS creates a serverless environment for your data migration. For different types of data migrations, Amazon DMS uses different native PostgreSQL database tools.

For homogeneous data migrations of the Full load type, Amazon DMS uses pg_dump to read data from your source database and store it on the disk attached to the serverless environment. After Amazon DMS reads all your source data, it uses pg_restore in the target database to restore your data.

For homogeneous data migrations of the Full load and change data capture (CDC) type, Amazon DMS uses pg_dump to read data from your source database and store it on the disk attached to the serverless environment. After Amazon DMS reads all your source data, it uses pg_restore in the target database to restore your data. After Amazon DMS completes the full load, it automatically switches to a publisher and subscriber model for logical replication. In this model, one or more subscribers subscribe to one or more publications on a publisher node.

For homogeneous data migrations of the Change data capture (CDC) type, Amazon DMS requires the native start point to start the replication. If you provide the native start point, then Amazon DMS captures changes from that point. Alternatively, choose Immediately in the data migration settings to automatically capture the start point for the replication when the actual data migration starts.

Note

For a CDC-only migration to work properly, all source database schemas and objects must already be present on the target database. The target may have objects that are not present on the source, however.

You can use the following code example to get the native start point in your PostgreSQL database.

select confirmed_flush_lsn from pg_replication_slots where slot_name=‘migrate_to_target';

This query uses the pg_replication_slots view in your PostgreSQL database to capture the log sequence number (LSN) value.

After Amazon DMS sets the status of your PostgreSQL homogeneous data migration to Stopped, Failed, or Deleted, the publisher and replication aren't removed. If you don't want to resume the migration, then delete the replication slot and the publisher by using the following command.

SELECT pg_drop_replication_slot('migration_subscriber_{ARN}'); DROP PUBLICATION publication_{ARN};

The following diagram shows the process of using homogeneous data migrations in Amazon DMS to migrate a PostgreSQL database to RDS for PostgreSQL or Aurora PostgreSQL.

An architecture diagram of the PostgreSQL data migration with DMS Homogeneous Data Migrations.