Example: Logical replication using Aurora PostgreSQL and Amazon Database Migration Service - Amazon Aurora
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).

Example: Logical replication using Aurora PostgreSQL and Amazon Database Migration Service

You can use the Amazon Database Migration Service (Amazon DMS) to replicate a database or a portion of a database. Use Amazon DMS to migrate your data from an Aurora PostgreSQL database to another open source or commercial database. For more information about Amazon DMS, see the Amazon Database Migration Service User Guide.

The following example shows how to set up logical replication from an Aurora PostgreSQL database as the publisher and then use Amazon DMS for migration. This example uses the same publisher and subscriber that were created in Example: Using logical replication with Aurora PostgreSQL DB clusters.

To set up logical replication with Amazon DMS, you need details about your publisher and subscriber from Amazon RDS. In particular, you need details about the publisher's writer DB instance and the subscriber's DB instance.

Get the following information for the publisher's writer DB instance:

  • The virtual private cloud (VPC) identifier

  • The subnet group

  • The Availability Zone (AZ)

  • The VPC security group

  • The DB instance ID

Get the following information for the subscriber's DB instance:

  • The DB instance ID

  • The source engine

To use Amazon DMS for logical replication with Aurora PostgreSQL
  1. Prepare the publisher database to work with Amazon DMS.

    To do this, PostgreSQL 10.x and later databases require that you apply Amazon DMS wrapper functions to the publisher database. For details on this and later steps, see the instructions in Using PostgreSQL version 10.x and later as a source for Amazon DMS in the Amazon Database Migration Service User Guide.

  2. Sign in to the Amazon Web Services Management Console and open the Amazon DMS console at https://console.amazonaws.cn/dms/v2. At top right, choose the same Amazon Region in which the publisher and subscriber are located.

  3. Create an Amazon DMS replication instance.

    Choose values that are the same as for your publisher's writer DB instance. These include the following settings:

    • For VPC, choose the same VPC as for the writer DB instance.

    • For Replication Subnet Group, choose a subnet group with the same values as the writer DB instance. Create a new one if necessary.

    • For Availability zone, choose the same zone as for the writer DB instance.

    • For VPC Security Group, choose the same group as for the writer DB instance.

  4. Create an Amazon DMS endpoint for the source.

    Specify the publisher as the source endpoint by using the following settings:

    • For Endpoint type, choose Source endpoint.

    • Choose Select RDS DB Instance.

    • For RDS Instance, choose the DB identifier of the publisher's writer DB instance.

    • For Source engine, choose postgres.

  5. Create an Amazon DMS endpoint for the target.

    Specify the subscriber as the target endpoint by using the following settings:

    • For Endpoint type, choose Target endpoint.

    • Choose Select RDS DB Instance.

    • For RDS Instance, choose the DB identifier of the subscriber DB instance.

    • Choose a value for Source engine. For example, if the subscriber is an RDS PostgreSQL database, choose postgres. If the subscriber is an Aurora PostgreSQL database, choose aurora-postgresql.

  6. Create an Amazon DMS database migration task.

    You use a database migration task to specify what database tables to migrate, to map data using the target schema, and to create new tables on the target database. At a minimum, use the following settings for Task configuration:

    • For Replication instance, choose the replication instance that you created in an earlier step.

    • For Source database endpoint, choose the publisher source that you created in an earlier step.

    • For Target database endpoint, choose the subscriber target that you created in an earlier step.

    The rest of the task details depend on your migration project. For more information about specifying all the details for DMS tasks, see Working with Amazon DMS tasks in the Amazon Database Migration Service User Guide.

After Amazon DMS creates the task, it begins migrating data from the publisher to the subscriber.