All Products
Search
Document Center

Data Transmission Service:Full migration from Amazon RDS for PostgreSQL to Alibaba Cloud

Last Updated:Mar 19, 2025

This topic describes how to use Data Transmission Service (DTS) to perform a full migration from Amazon RDS for PostgreSQL to Alibaba Cloud RDS for PostgreSQL.

Prerequisites

  • The database version of Amazon RDS for PostgreSQL is 9.4 or later.

  • To ensure DTS can establish a connection with Amazon RDS for PostgreSQL over the Internet, you need to configure the Publicly accessible setting to Yes for Amazon RDS for PostgreSQL.

  • An Alibaba Cloud RDS for PostgreSQL instance has been successfully created. For more information, see how to create an RDS for PostgreSQL instance.

    Note

    The major version of the Alibaba Cloud RDS for PostgreSQL database is recommended to be consistent with the major version of the Amazon RDS for PostgreSQL instance. If you need to perform a cross-version migration, create a pay-as-you-go instance to verify compatibility.

  • The storage space of Alibaba Cloud RDS for PostgreSQL must be greater than the storage space occupied by the database to be migrated from Amazon RDS for PostgreSQL.

Precautions

  • DTS uses read and write resources of the source and destination databases during full data migration. This may increase the loads of the database servers. If the database performance is unfavorable, the specification is low, or the data volume is large, database services may become unavailable. For example, DTS occupies a large amount of read and write resources in the following cases: a large number of slow SQL queries are performed on the source database, the tables have no primary keys, or a deadlock occurs in the destination database. Before you migrate data, evaluate the impact of data migration on the performance of the source and destination databases. We recommend that you migrate data during off-peak hours. For example, you can migrate data when the CPU utilization of the source and destination databases is less than 30%.

  • Incremental data migration is not supported. This means that you need to stop the relevant business of Amazon RDS for PostgreSQL before performing data migration. To ensure data consistency, do not write new data to Amazon RDS for PostgreSQL during the migration.

  • A data migration task can only migrate one database. If multiple databases need to be migrated, a data migration task must be created for each database.

  • Functions written in C language are not supported for migration.

  • The tables to be migrated in the source database must have PRIMARY KEY or UNIQUE constraints and all fields must be unique. Otherwise, the destination database may contain duplicate data records.

  • For failed migration tasks, DTS will trigger automatic recovery. Before you switch your business to the destination instance, be sure to stop or release the task to prevent the data in the source instance from overwriting the data in the destination instance after the task is automatically resumed.

Billing description

Migration type

Link configuration cost

Data transfer cost

Schema migration and full data migration

Free of charge

Charges apply when data is migrated out of Alibaba Cloud over the Internet. For more information, see Billing overview.

Migration type description

  • Schema migration

    DTS migrates the schema definitions of the objects to Alibaba Cloud RDS for PostgreSQL. The objects that support schema migration include table, trigger, view, sequence, function, user-defined type, rule, domain, operation, and aggregate.

  • Full data migration

    All historical data of the migration objects is migrated to the Alibaba Cloud RDS for PostgreSQL database.

Permissions required for database accounts

Database

Schema migration

Full migration

Amazon RDS for PostgreSQL

USAGE permission on pg_catalog

SELECT permission on the objects to be migrated

Alibaba Cloud RDS for PostgreSQL

CREATE and USAGE permissions on the objects to be migrated

Permissions of the schema owner

Full data migration procedure

To resolve dependencies between objects and improve the success rate of migration, DTS migrates PostgreSQL schemas and data in the following order.

  1. Execute schema migration for tables, views, sequences, functions, user-defined types, rules, domains, operations, and aggregates.

  2. Perform a full data migration.

  3. Execute schema migration for triggers and foreign keys.

Preparation 1: Adjust inbound rules of Amazon

  1. Log on to the Amazon RDS Management Console.

  2. Navigate to the Basic Information page of Amazon RDS for PostgreSQL.

  3. In the Security group rules section, click the name of the security group to which the existing inbound rule belongs.

    安全组规则

  4. On the Security Group Settings page, include the DTS server address for the relevant region in the inbound rules. For information on the IP address range, see the required IP whitelist for local database migration, synchronization, or subscription.

    AWS postgresql入站规则

    Note
    • You need to add only the CIDR blocks of DTS servers that reside in the same region as the destination database. For example, the source database resides in the Singapore region and the destination database resides in the China (Hangzhou) region. You need to add only the CIDR blocks of DTS servers that reside in the China (Hangzhou) region.

    • You can add all of the required CIDR blocks to the inbound rule at a time.

    • If you have other questions, see the official documentation of Amazon or contact technical support.

Preparation 2: Create databases and schemas in Alibaba Cloud RDS instance

Create databases and schemas in Alibaba Cloud RDS for PostgreSQL that correspond to the ones from which the objects are being migrated, ensuring the schema names match exactly. For more information, see Create a database and Schema management.

Procedure (in the new DTS console)

  1. Use one of the following methods to go to the Data Migration page and select the region in which the data migration instance resides.

    DTS console

    1. Log on to the DTS console.

    2. In the left-side navigation pane, click Data Migration.

    3. In the upper-left corner of the page, select the region in which the data migration instance resides.

    DMS console

    Note

    The actual operation may vary based on the mode and layout of the DMS console. For more information, see Simple mode and Customize the layout and style of the DMS console.

    1. Log on to the DMS console.

    2. In the top navigation bar, move the pointer over Data + AI > DTS (DTS) > Data Migration .

    3. From the drop-down list to the right of Data Migration Tasks, select the region in which the data synchronization instance resides.

  2. Click Create Task to go to the task configuration page.

  3. Configure the source and destination databases. The following table describes the parameters.

    Warning

    After you configure the source and destination databases, we recommend that you read the Limits that are displayed in the upper part of the page. Otherwise, the task may fail or data inconsistency may occur.

    Category

    Configuration

    Description

    None

    Task Name

    The name of the DTS task. DTS automatically generates a task name. We recommend that you specify an informative name that makes it easy to identify the task. You do not need to specify a unique task name.

    Source Database

    Select a DMS database instance.

    The instance that you want to use. You can choose whether to use an existing instance based on your business requirements.

    • If you select an existing instance, DTS automatically populates the parameters for the database.

    • If you do not use an existing instance, you must configure the database information below.

    Note

    Database Type

    Select PostgreSQL.

    Access Method

    Select Public IP.

    Instance Region

    Select the region where the Amazon RDS for PostgreSQL database resides.

    Note

    If the region where the Amazon RDS for PostgreSQL database resides is not available in the options, you can select the region closest to the database.

    Domain Name or IP

    Enter the endpoint of Amazon RDS for PostgreSQL.

    Note

    You can obtain the endpoint of the database on the Basic Information page of Amazon RDS for PostgreSQL.

    Port

    Enter the service port of Amazon RDS for PostgreSQL. The default value is 5432.

    Database Name

    Enter the name of the database to be migrated from Amazon RDS for PostgreSQL.

    Database Account

    Enter the database account of Amazon RDS for PostgreSQL. For permission requirements, see Permissions required for database accounts.

    Database Password

    The password that is used to access the database instance.

    Encryption

    Specifies whether to encrypt the connection to the source database. You can configure this parameter based on your business requirements. In this example, Non-encrypted is selected.

    If you want to establish an SSL-encrypted connection to the source database, perform the following steps: Select SSL-encrypted, upload CA Certificate, Client Certificate, and Private Key of Client Certificate as needed, and then specify Private Key Password of Client Certificate.

    Note
    • If you set Encryption to SSL-encrypted for a self-managed PostgreSQL database, you must upload CA Certificate.

    • If you want to use the client certificate, you must upload Client Certificate and Private Key of Client Certificate and specify Private Key Password of Client Certificate.

    • For information about how to configure SSL encryption for an ApsaraDB RDS for PostgreSQL instance, see SSL encryption.

    Destination Database

    Select a DMS database instance.

    The instance that you want to use. You can choose whether to use an existing instance based on your business requirements.

    • If you select an existing instance, DTS automatically populates the parameters for the database.

    • If you do not use an existing instance, you must configure the database information below.

    Note

    Database Type

    Select PostgreSQL.

    Access Method

    Select Cloud Instance.

    Instance Region

    Select the region where the destination RDS for PostgreSQL instance resides.

    Instance ID

    Select the destination RDS for PostgreSQL instance ID.

    Database Name

    Enter the name of the database to be migrated to Alibaba Cloud RDS for PostgreSQL. It can be different from the name of the database to be migrated from Amazon RDS for PostgreSQL.

    Note

    The database must exist in Alibaba Cloud RDS for PostgreSQL. For information about how to create a database, see Create a database.

    Database Account

    Enter the database account of the destination RDS for PostgreSQL instance. For permission requirements, see Permissions required for database accounts.

    Database Password

    The password that is used to access the database instance.

    Encryption

    Specifies whether to encrypt the connection to the source database. You can configure this parameter based on your business requirements. In this example, Non-encrypted is selected.

    If you want to establish an SSL-encrypted connection to the source database, perform the following steps: Select SSL-encrypted, upload CA Certificate, Client Certificate, and Private Key of Client Certificate as needed, and then specify Private Key Password of Client Certificate.

    Note
    • If you set Encryption to SSL-encrypted for a self-managed PostgreSQL database, you must upload CA Certificate.

    • If you want to use the client certificate, you must upload Client Certificate and Private Key of Client Certificate and specify Private Key Password of Client Certificate.

    • For information about how to configure SSL encryption for an ApsaraDB RDS for PostgreSQL instance, see SSL encryption.

  4. In the lower part of the page, click Test Connectivity and Proceed, and then click Test Connectivity in the CIDR Blocks of DTS Servers dialog box that appears.

    Note

    Make sure that the CIDR blocks of DTS servers can be automatically or manually added to the security settings of the source and destination databases to allow access from DTS servers. For more information, see Add the CIDR blocks of DTS servers.

  5. Configure the objects to be migrated.

    1. On the Configure Objects page, configure the objects that you want to migrate.

      Configuration

      Description

      Migration Types

      Select both Schema Migration and Full Migration.

      Note

      To ensure data consistency, do not write new data to the Amazon RDS for PostgreSQL database during the migration.

      Processing Mode of Conflicting Tables

      • Precheck and Report Errors: checks whether the destination database contains tables that use the same names as tables in the source database. If the source and destination databases do not contain tables that have identical table names, the precheck is passed. Otherwise, an error is returned during the precheck and the data migration task cannot be started.

        Note

        If the source and destination databases contain tables with identical names and the tables in the destination database cannot be deleted or renamed, you can use the object name mapping feature to rename the tables that are migrated to the destination database. For more information, see Map object names.

      • Ignore Errors and Proceed: skips the precheck for identical table names in the source and destination databases.

        Warning

        If you select Ignore Errors and Proceed, data inconsistency may occur and your business may be exposed to the following potential risks:

        • If the source and destination databases have the same schema, and a data record has the same primary key as an existing data record in the destination database, the following scenarios may occur:

          • During full data migration, DTS does not migrate the data record to the destination database. The existing data record in the destination database is retained.

          • During incremental data migration, DTS migrates the data record to the destination database. The existing data record in the destination database is overwritten.

        • If the source and destination databases have different schemas, only specific columns are migrated or the data migration task fails. Proceed with caution.

      Capitalization of Object Names in Destination Instance

      The capitalization of database names, table names, and column names in the destination instance. By default, DTS default policy is selected. You can select other options to make sure that the capitalization of object names is consistent with that of the source or destination database. For more information, see Specify the capitalization of object names in the destination instance.

      Source Objects

      Select one or more objects from the Source Objects section. Click the Rightwards arrow icon and add the objects to the Selected Objects section.

      Note

      You can select columns, tables, or schemas as the objects to be migrated. If you select tables or columns as the objects to be migrated, DTS does not migrate other objects, such as views, triggers, or stored procedures, to the destination database.

      Selected Objects

      • To rename an object that you want to migrate to the destination instance, right-click the object in the Selected Objects section. For more information, see Map the name of a single object.

      • To rename multiple objects at a time, click Batch Edit in the upper-right corner of the Selected Objects section. For more information, see Map multiple object names at a time.

      Note

      If you use the object name mapping feature, other objects that are dependent on the object may fail to be migrated.

    2. Click Next: Advanced Settings to configure advanced settings.

      Configuration

      Description

      Dedicated Cluster for Task Scheduling

      By default, DTS schedules the data migration task to the shared cluster if you do not specify a dedicated cluster. If you want to improve the stability of data migration tasks, purchase a dedicated cluster. For more information, see What is a DTS dedicated cluster.

      Retry Time for Failed Connections

      The retry time range for failed connections. If the source or destination database fails to be connected after the data migration task is started, DTS immediately retries a connection within the retry time range. Valid values: 10 to 1,440. Unit: minutes. Default value: 720. We recommend that you set the parameter to a value greater than 30. If DTS is reconnected to the source and destination databases within the specified retry time range, DTS resumes the data migration task. Otherwise, the data migration task fails.

      Note
      • If you specify different retry time ranges for multiple data migration tasks that share the same source or destination database, the value that is specified later takes precedence.

      • When DTS retries a connection, you are charged for the DTS instance. We recommend that you specify the retry time range based on your business requirements. You can also release the DTS instance at the earliest opportunity after the source database and destination instance are released.

      Retry Time for Other Issues

      The retry time range for other issues. For example, if DDL or DML operations fail to be performed after the data migration task is started, DTS immediately retries the operations within the retry time range. Valid values: 1 to 1440. Unit: minutes. Default value: 10. We recommend that you set the parameter to a value greater than 10. If the failed operations are successfully performed within the specified retry time range, DTS resumes the data migration task. Otherwise, the data migration task fails.

      Important

      The value of the Retry Time for Other Issues parameter must be smaller than the value of the Retry Time for Failed Connections parameter.

      Enable Throttling for Full Data Migration

      Specifies whether to enable throttling for full data migration. During full data migration, DTS uses the read and write resources of the source and destination databases. This may increase the loads of the database servers. You can enable throttling for full data migration based on your business requirements. To configure throttling, you must configure the Queries per second (QPS) to the source database, RPS of Full Data Migration, and Data migration speed for full migration (MB/s) parameters. This reduces the loads of the destination database server.

      Note

      You can configure this parameter only if you select Full Data Migration for the Migration Types parameter.

      Environment Tag

      Select an environment tag that meets your business needs. This example does not feature a selected environment tag.

      Configure ETL

      Specifies whether to enable the extract, transform, and load (ETL) feature. For more information, see What is ETL? Valid values:

      Monitoring and Alerting

      Specifies whether to configure alerting for the data migration task. If the task fails or the migration latency exceeds the specified threshold, the alert contacts receive notifications. Valid values:

    3. Click Next Step: Data Verification to configure the data verification task.

      For more information about how to use the data verification feature, see Configure a data verification task.

  6. Save the task settings and run a precheck.

    • To view the parameters to be specified when you call the relevant API operation to configure the DTS task, move the pointer over Next: Save Task Settings and Precheck and click Preview OpenAPI parameters.

    • If you do not need to view or have viewed the parameters, click Next: Save Task Settings and Precheck in the lower part of the page.

    Note
    • Before you can start the data migration task, DTS performs a precheck. You can start the data migration task only after the task passes the precheck.

    • If the task fails to pass the precheck, click View Details next to each failed item. After you analyze the causes based on the check results, troubleshoot the issues. Then, run a precheck again.

    • If an alert is triggered for an item during the precheck:

      • If an alert item cannot be ignored, click View Details next to the failed item and troubleshoot the issues. Then, run a precheck again.

      • If the alert item can be ignored, click Confirm Alert Details. In the View Details dialog box, click Ignore. In the message that appears, click OK. Then, click Precheck Again to run a precheck again. If you ignore the alert item, data inconsistency may occur, and your business may be exposed to potential risks.

  7. Purchase an instance.

    1. Wait until Success Rate becomes 100%. Then, click Next: Purchase Instance.

    2. On the Purchase Instance page, configure the Instance Class parameter for the data migration instance. The following table describes the parameters.

      Section

      Parameter

      Description

      New Instance Class

      Resource Group

      The resource group to which the data migration instance belongs. Default value: default resource group. For more information, see What is Resource Management?

      Instance Class

      DTS provides instance classes that vary in the migration speed. You can select an instance class based on your business scenario. For more information, see Instance classes of data migration instances.

    3. Read and agree to Data Transmission Service (Pay-as-you-go) Service Terms by selecting the check box.

    4. Click Buy and Start. In the message that appears, click OK.

      You can view the progress of the task on the Data Migration page.

Procedure (in the old DTS console)

  1. Log on to the DTS console.

    Note

    If you are redirected to the Data Management (DMS) console, you can click the old icon in the image to go to the previous version of the DTS console.

  2. In the left-side navigation pane, click Data Migration.

  3. At the top of the Migration Tasks page, select the region where the destination cluster resides.

  4. In the upper-right corner of the page, click Create Migration Task.

  5. Configure the source and destination database information for the migration task.

    源库及目标库配置

    Category

    Configuration

    Description

    None

    Task name

    DTS automatically generates a task name. We recommend that you specify a descriptive name that makes it easy to identify the task. You do not need to specify a unique task name.

    Source instance information

    Instance type

    Select Self-managed Database With Public IP.

    Instance region

    The region where the source instance resides. This parameter does not need to be set when the instance type is set to Self-managed Database With Public IP.

    Database type

    Select PostgreSQL.

    Hostname or IP address

    Enter the connection address of Amazon RDS for PostgreSQL.

    Note

    You can obtain the connection information of the database on the Basic Information page of Amazon RDS for PostgreSQL.

    连接地址

    Port

    Enter the service port of Amazon RDS for PostgreSQL. The default value is 5432.

    Database name

    Enter the name of the database to be migrated from Amazon RDS for PostgreSQL.

    Database account

    Enter the database account of Amazon RDS for PostgreSQL. For permission requirements, see Permissions required for database accounts.

    Database password

    Enter the password of the account that is used to connect to the database.

    Note

    After you configure the source database parameters, click Test Connectivity next to Database Password to verify whether the configured parameters are valid. If the configured parameters are valid, the Passed message is displayed. If the Failed message is displayed, click Check next to Failed to modify the source database parameters based on the check results.

    Destination instance information

    Instance type

    Select RDS Instance.

    Instance region

    Select the region where the Alibaba Cloud RDS for PostgreSQL instance resides.

    RDS instance ID

    Select the Alibaba Cloud RDS for PostgreSQL instance ID.

    Database name

    Enter the name of the database to be migrated to Alibaba Cloud RDS for PostgreSQL. It can be different from the name of the database to be migrated from Amazon RDS for PostgreSQL.

    Note

    You need to create the corresponding databases and schemas in Alibaba Cloud RDS for PostgreSQL in advance. For more information, see Preparation 2: Create databases and schemas in Alibaba Cloud RDS instance.

    Database account

    Enter the database account of Alibaba Cloud RDS for PostgreSQL. For permission requirements, see Permissions required for database accounts.

    Database password

    Enter the password of the account that is used to connect to the database.

    Note

    After you configure the destination database parameters, click Test Connectivity next to Database Password to verify whether the configured parameters are valid. If the configured parameters are valid, the Passed message is displayed. If the Failed message is displayed, click Check next to Failed to modify the destination database parameters based on the check results.

  6. After the configuration is complete, click Authorize Whitelist And Proceed To The Next Step in the lower-right corner of the page.

    If the source or destination database is an Alibaba Cloud database instance (such as RDS MySQL or ApsaraDB for MongoDB), DTS automatically adds the DTS service IP address in the corresponding region to the whitelist of the Alibaba Cloud database instance. If the source or destination database is a self-managed database on ECS, DTS automatically adds the DTS service IP address in the corresponding region to the ECS security rules. Ensure that the self-managed database does not restrict access from ECS (for databases deployed on multiple ECS instances in a cluster, manually add the DTS service IP address in the corresponding region to the security rules of each ECS instance). If the source or destination database is a self-managed database in an IDC or another cloud database, manually add the DTS service IP address in the corresponding region to allow access from DTS servers. For the DTS service IP address range, see IP address range of DTS servers.

    Warning

    If the CIDR blocks of DTS servers are automatically or manually added to the whitelist of the database or instance, or to the ECS security group rules, security risks may arise. Therefore, before you use DTS to migrate data, you must understand and acknowledge the potential risks and take preventive measures, including but not limited to the following measures: enhance the security of your username and password, limit the ports that are exposed, authenticate API calls, regularly check the whitelist or ECS security group rules and forbid unauthorized CIDR blocks, or connect the database to DTS by using Express Connect, VPN Gateway, or Smart Access Gateway.

  7. Select the migration objects and migration type.

    Configuration

    Description

    Migration type

    Incremental data migration is not supported. Select both Incremental Data MigrationSchema Migration and Full Data Migration.

    Note

    To ensure data consistency, do not write new data to the Amazon RDS for PostgreSQL database during the migration.

    Migration objects

    In the Migration Objects box, click the objects to be migrated, and then click 向右小箭头 to move them to the Selected Objects box.

    Note
    • The granularity of the migration object selection is database, table, and column.

    • By default, after an object is migrated, the object name in the destination database remains the same as the object name in the source database. If you need to change the name of the migration object in the destination database, you need to use the object name mapping feature. For more information, see Mapping of database and table column names.

    • If you use the object name mapping feature, other objects that are dependent on the object may fail to be migrated.

    Rename databases and tables

    If you need to change the name of the migration object in the destination instance, use the object name mapping feature. For more information, see Mapping of database and table column names.

    Retry time for failed connections to the source and destination databases

    By default, if DTS fails to connect to the source or destination database, DTS retries within the next 12 hours. You can specify a retry time range based on your business requirements. If DTS reconnects to the source and destination databases within the specified time, the migration task will automatically resume. Otherwise, the migration task will fail.

    Note

    During the connection retry period, you are charged for the operation of the DTS instance. We recommend that you specify the retry time based on your business needs or release the DTS instance in a timely manner after the source and destination instances are released.

  8. In the lower-right corner of the page, click Precheck.

    Note
    • Before you can start the data migration task, DTS performs a precheck. You can start the data migration task only after the task passes the precheck.

    • If the task fails to pass the precheck, you can click the Info icon icon next to each failed item to view details.

      • You can troubleshoot the issues based on the causes and run a precheck again.

      • If you do not need to troubleshoot the issues, you can ignore failed items and run a precheck again.

  9. After the task passes the precheck, click Next.

  10. In the Confirm Settings dialog box, specify the Channel Specification parameter and select Data Transmission Service (Pay-As-You-Go) Service Terms.

  11. Click Buy and Start to start the data migration task.
    Note We recommend that you do not manually stop the task during full data migration. Otherwise, the data migrated to the destination database will be incomplete. You can wait until the data migration task automatically stops.
    Full data migration
  12. Switch your business to Alibaba Cloud RDS for PostgreSQL.