All Products
Search
Document Center

ApsaraDB RDS:Migrate full data from an Amazon RDS for PostgreSQL instance to an ApsaraDB RDS for PostgreSQL instance

Last Updated:Mar 28, 2026

Data Transmission Service (DTS) supports full data migration from Amazon RDS for PostgreSQL to ApsaraDB RDS for PostgreSQL. This is an offline migration — incremental data migration is not supported. Stop all services on the source instance before you start.

In this tutorial, you will:

  • Add DTS server CIDR blocks to the Amazon RDS inbound rules

  • Create the destination database and schema on ApsaraDB RDS for PostgreSQL

  • Configure and run a DTS migration task (schema migration + full data migration)

  • Switch your workloads to the destination instance

How it works

To prevent dependency failures, DTS migrates objects in this order:

  1. Migrate schemas of tables, views, sequences, functions, user-defined types, rules, domains, operations, and aggregates.

  2. Migrate all existing data.

  3. Migrate schemas of triggers and foreign keys.

Prerequisites

Before you begin, ensure that you have:

  • An Amazon RDS for PostgreSQL instance running version 9.4 or later, with Public accessibility set to Yes

  • An ApsaraDB RDS for PostgreSQL instance already created — use the same major version as the source when possible; to migrate across versions, test compatibility on a pay-as-you-go instance first (Create an instance)

  • Available storage on the destination instance that exceeds the total data size of the source instance

  • Database accounts with the required permissions on both instances (see Permissions required for database accounts)

Limitations

LimitationDetailsConsequence if ignored
No incremental migrationFull data migration only. Stop all services on the source before starting.Data written during migration is lost.
Single database per taskEach DTS task migrates one database. Create separate tasks for each database.Additional databases are not migrated.
No C-language functionsDTS skips functions written in C. Migrate these manually after cutover if needed.Functions are silently skipped; applications relying on them will fail post-cutover.
Primary key or unique constraint requiredTables without a PRIMARY KEY or UNIQUE constraint may result in duplicate records in the destination.Duplicate rows in destination tables; no automatic deduplication.
Auto-resume on failureIf the task fails and resumes automatically, it overwrites destination data. Stop or release the task before switching workloads.Source data overwrites destination data after the task resumes.
Resource impactDTS consumes read and write resources on both databases. Run the migration during off-peak hours — ideally when CPU utilization on both databases is below 30%.Performance degradation or service interruption on source or destination.

Billing

Migration typeInstance configuration feeInternet traffic fee
Schema migration and full data migrationFreeCharged when data egresses from Alibaba Cloud over the Internet. See Billing overview.

Permissions required for database accounts

DatabaseSchema migrationFull data migration
Amazon RDS for PostgreSQLUSAGE on pg_catalogSELECT on the objects to be migrated
ApsaraDB RDS for PostgreSQLCREATE and USAGE on the objects to be migratedSchema owner permissions

Step 1: Add DTS CIDR blocks to the Amazon RDS inbound rules

DTS connects to the source Amazon RDS for PostgreSQL instance over the Internet. Add the DTS server CIDR blocks for the destination region to the instance's security group inbound rules.

  1. Log on to the Amazon RDS Management console and go to the basic information page of the source instance.

  2. In the Security group rules section, click the name of the security group.

    安全组规则

  3. On the Security groups page, go to Inbound > Edit. In the Edit inbound rules dialog box, add the CIDR blocks for the destination database region.

    Add only the CIDR blocks for the region where the destination database resides. For example, if the destination is in China (Hangzhou), add only the China (Hangzhou) CIDR blocks — even if the source is in a different region such as Singapore. You can add all required CIDR blocks in a single edit. For the full list of CIDR blocks, see Add the CIDR blocks of DTS servers.

    AWS postgresql入站规则

Step 2: Create the destination database and schema

Create a database and schema in the destination ApsaraDB RDS for PostgreSQL instance. The schema name must match the source schema name exactly.

See Create a database and Manage accounts by using schemas.

Step 3: Create a DTS migration task

Open the data migration page

Use either the DTS console or the DMS console to open the Data Migration page.

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, select the region where the migration instance will reside.

DMS console:

The layout varies based on your DMS console mode. 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, go to Data + AI > DTS (DTS) > Data Migration.

  3. From the drop-down list to the right of Data Migration Tasks, select the region.

Configure the source and destination databases

  1. Click Create Task.

  2. Configure the source database:

    To use an existing DMS database instance, select it under Select a DMS database instance — DTS fills in the parameters automatically. To register a new instance, see Register an Alibaba Cloud database instance and Register a database hosted on a third-party cloud service or a self-managed database.
    ParameterValue
    Database typePostgreSQL
    Access methodPublic IP Address
    Instance regionThe region of the Amazon RDS for PostgreSQL instance. If the exact region is not listed, select the geographically closest one.
    Domain name or IPThe endpoint of the Amazon RDS for PostgreSQL instance (available on the instance's basic information page)
    Port number5432 (default)
    Database nameThe name of the source database
    Database accountThe account with the required permissions (see Permissions required for database accounts)
    Database passwordThe account password
    EncryptionSelect Non-encrypted or SSL-encrypted based on your requirements. For SSL, upload the CA Certificate, Client Certificate, and Private Key of Client Certificate as needed, then set the Private Key Password of Client Certificate. See SSL encryption.
  3. Configure the destination database:

    Warning

    Read the Limits displayed at the top of the page after configuring the source and destination databases. Ignoring these may cause task failure or data inconsistency.

    ParameterValue
    Database typePostgreSQL
    Access methodAlibaba Cloud Instance
    Instance regionThe region of the destination ApsaraDB RDS for PostgreSQL instance
    Instance IDThe ID of the destination instance
    Database nameThe name of the destination database (can differ from the source database name)
    Database accountThe account with the required permissions (see Permissions required for database accounts)
    Database passwordThe account password
    EncryptionConfigure the same as the source if needed
  4. Click Test connectivity and proceed. In the CIDR blocks of DTS servers dialog box, click Test Connectivity.

    DTS must be able to reach both databases. If connectivity fails, verify that the CIDR blocks from Step 1 are correctly added. For more information, see Add the CIDR blocks of DTS servers.

Select objects to migrate

On the Configure objects page:

ParameterConfiguration
Migration typesSelect Schema migration and Full data migration. Do not write to the source during migration.
Processing mode of conflicting tablesPrecheck and report errors (recommended): fails the precheck if the destination has tables with identical names, preventing accidental overwrites. Ignore errors and proceed: skips the check and may cause data inconsistency — use with caution.
Capitalization of object names in destination instanceDTS default policy (default). Change if your application requires specific casing. See Specify the capitalization of object names in the destination instance.
Source objectsSelect objects from Source objects and click 向右小箭头 to move them to Selected objects. You can select columns, tables, or schemas.
Selected objectsRight-click an object to rename it, or click Batch edit to rename multiple objects. See Map object names. Renaming an object may cause dependent objects to fail migration.

Click Next: Advanced settings.

Configure advanced settings

ParameterDescription
Dedicated cluster for task schedulingLeave as default (shared cluster) unless you have a dedicated cluster. See What is a DTS dedicated cluster?
Retry time for failed connectionsHow long DTS retries if it loses connection to a database. Range: 10–1,440 minutes. Default: 720. Set to greater than 30. If reconnected within this window, the task resumes automatically; otherwise it fails.
Retry time for other issuesHow long DTS retries failed DDL or DML operations. Range: 1–1,440 minutes. Default: 10. Set to greater than 10. Must be less than Retry time for failed connections.
Enable throttling for full data migrationLimit DTS resource usage on the source and destination by setting QPS (queries per second), RPS of full data migration, and data migration speed (MB/s).
Configure ETLEnable extract, transform, and load (ETL) processing if you need to transform data during migration. See Configure ETL in a data migration or data synchronization task.
Monitoring and alertingConfigure alert thresholds and notification contacts so you are notified if the task fails or latency exceeds the threshold. See Configure monitoring and alerting.

Click Next step: Data verification if you want to configure data verification. See Configure a data verification task.

Run the precheck and purchase the instance

  1. Click Next: Save task settings and precheck.

    To preview the API parameters for this task, hover over the button and click Preview OpenAPI parameters before proceeding.
  2. Review the precheck results. Fix any failed items and rerun the precheck.

    • For failed items, click View details to see the cause, resolve the issue, and click Precheck again.

    • For alert items that can be safely ignored, click Confirm alert details > Ignore > OK, then click Precheck again.

  3. After Success rate reaches 100%, click Next: Purchase instance.

  4. On the Purchase instance page, configure the instance class:

    ParameterDescription
    Resource groupThe resource group for the migration instance. Default: default resource group. See What is Resource Management?
    Instance classControls migration speed. Select based on your data volume and timeline. See Instance classes of data migration instances.
  5. Read and accept Data Transmission Service (Pay-as-you-go) Service Terms, then click Buy and start > OK.

The task starts automatically. Track progress on the Data Migration page.

Step 4: Switch workloads to ApsaraDB RDS for PostgreSQL

After full data migration completes:

  1. Stop all services on the source Amazon RDS for PostgreSQL instance.

  2. Stop or release the DTS migration task to prevent it from resuming and overwriting data on the destination.

  3. Update your application connection strings to point to the ApsaraDB RDS for PostgreSQL instance.

Appendix: Procedure in the old DTS console

If you are using the previous version of the DTS console, follow these steps.

If the DTS console redirects you to DMS, click the old icon in the image to switch back to the old console.
  1. Log on to 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 instance resides.

  4. In the upper-right corner, click Create migration task.

  5. Configure the source and destination databases:

    SectionParameterValue
    N/ATask nameAn auto-generated name. Change it to something descriptive.
    Source databaseInstance typeUser-Created Database with Public IP Address
    Database typePostgreSQL
    Hostname or IP addressThe endpoint of the Amazon RDS for PostgreSQL instance (available on the instance's basic information page) 连接地址
    Port number5432 (default)
    Database nameThe name of the source database
    Database accountThe account with the required permissions
    Database passwordThe account password. Click Test connectivity next to the field to verify the connection.
    Destination databaseInstance typeRDS Instance
    Instance regionThe region of the destination ApsaraDB RDS for PostgreSQL instance
    RDS instance IDThe ID of the destination instance
    Database nameThe name of the destination database (can differ from the source)
    Database accountThe account with the required permissions
    Database passwordThe account password. Click Test connectivity next to the field to verify the connection.

    源库及目标库配置

  6. Click Set whitelist and next. DTS automatically adds its CIDR blocks to the whitelist of Alibaba Cloud database instances and to the security group rules of ECS-hosted databases. For third-party cloud databases, you must add the CIDR blocks manually.

    Warning

    Adding DTS CIDR blocks to your whitelist or security group rules may expose your database to security risks. Take preventive measures such as enforcing strong credentials, restricting exposed ports, authenticating API calls, and auditing whitelist entries regularly. Alternatively, connect the database to DTS through Express Connect, VPN Gateway, or Smart Access Gateway.

  7. Select the migration types and objects:

    SettingConfiguration
    Migration typesSelect Schema migration and Full data migration. Incremental data migration is not supported in this scenario. Do not write to the source during migration.
    Objects to migrateSelect objects from Available and click 向右小箭头 to move them to Selected. You can select columns, tables, or databases.
    Object name mappingRight-click an object in Selected to rename it. See Object name mapping.
    Retry time for failed connectionsDefault: 12 hours. Adjust based on your requirements.
  8. Click Precheck.

    • Fix any failed items and rerun the precheck.

    • Optionally ignore non-critical failed items and rerun.

  9. After the precheck passes, click Next.

  10. In the Confirm settings dialog box, select the Channel specification and accept Data Transmission Service (Pay-As-You-Go) Service Terms.

  11. Click Buy and start.

    Do not stop the task manually during full data migration — this leaves the destination data incomplete. Wait for the task to stop automatically.

    Full data migration

  12. After migration completes, switch your workloads to the ApsaraDB RDS for PostgreSQL instance.