All Products
Search
Document Center

ApsaraDB RDS:Use the cloud migration feature to migrate data between ApsaraDB RDS for PostgreSQL instances

Last Updated:Mar 28, 2026

The cloud migration feature uses physical streaming replication to move data between ApsaraDB RDS for PostgreSQL instances — no third-party tools required. Use this feature for cross-region migrations or instance-level upgrades where you need a fast, low-complexity path with minimal application changes after switchover.

Prerequisites

Before you begin, make sure the following conditions are met:

  • The source and destination instances run the same major PostgreSQL version. PostgreSQL 10 and later are supported.

  • The destination instance is a primary instance. Read-only instances cannot be migration targets.

  • The destination instance uses cloud disks.

  • The destination instance is empty, and its available storage is greater than or equal to the data size of the source instance.

  • The virtual private cloud (VPC) CIDR block of the source instance differs from the VPC CIDR block of the destination instance.

Billing for cross-region migrations

Cross-region migrations require Cloud Enterprise Network (CEN) to connect the source and destination instances over an internal network. CEN cross-region traffic is billed separately. For details, see What is CEN? and Billing.

How it works

The migration runs in three phases:

  1. Set up cross-region networking — Connect the source and destination VPCs through CEN so that the two instances can communicate over an internal network.

  2. Run the feasibility assessment — Verify that the source instance is ready for migration.

  3. Migrate data and switch over — Start the cloud migration task, then switch workloads to the destination instance when incremental data synchronization begins.

Note

The following steps use an example where the source instance is in the China (Beijing) region and the destination instance is in the China (Hangzhou) region. Skip Step 1 if both instances are in the same region.

Step 1: Set up CEN for cross-region connectivity

1.1 Create a CEN instance

  1. Log on to the CEN console.

  2. On the Instances page, click Create CEN Instance.

  3. In the Create CEN Instance dialog box, configure the parameters and click OK.

    ParameterDescription
    NameEnter a name. The name must be 2–128 characters and can contain digits, hyphens (-), and underscores (_). It must start with a letter.
    Description(Optional) Enter a description. The description must be 2–256 characters and cannot start with http:// or https://.

1.2 Add the source and destination VPCs to the CEN instance

Add both VPCs separately. The following steps show how to add the source VPC. Repeat the steps to add the destination VPC, selecting the corresponding region and network instance each time.

  1. On the Instances page, click the ID of the CEN instance you created.

  2. On the Basic Information tab, click the 添加网络实例 icon to the right of the VPC count.VPC后的加好

  3. On the Connection with Peer Network Instance page, configure the parameters and click OK.

    ParameterDescription
    Instance typeRetain the default value Virtual Private Cloud (VPC).
    RegionSelect the region of the instance whose VPC you are adding. For the source instance, select China (Beijing).
    Transit routerNo transit routers are available by default. CEN automatically creates one. Select the primary zone and secondary zone for the transit router.
    Resource owner IDSelect Current Account.
    Attachment nameEnter a name for the attachment.
    Network instanceSelect the VPC ID of the instance. To find the VPC ID, go to Database Connection in the ApsaraDB RDS console.源实例VPC实例ID After selecting the VPC, choose the vSwitches associated with the primary zone and secondary zone of the transit router.

After adding both VPCs, the CEN instance shows both network attachments.云企业网路由

1.3 Purchase a bandwidth plan

  1. On the Instances page, click the ID of your CEN instance.

  2. On the Basic Information tab, click Bandwidth Plans, then click Purchase Bandwidth Plan (Subscription).

  3. Configure the parameters and click Buy Now to complete the purchase.

    ParameterDescription
    CEN IDThe CEN instance is pre-selected. The bandwidth plan is automatically associated with it after purchase.
    Area ASelect an area for cross-region communication. In this example, select Mainland China.
    Note

    You cannot change the area after the bandwidth plan is purchased.

    Area BSelect the other area. In this example, select Mainland China.
    Billing methodRetain the default value Pay-By-Bandwidth.
    BandwidthSpecify the bandwidth in Mbit/s.
    Bandwidth package nameEnter a name for the bandwidth plan.
    Order timeSelect a subscription duration. Optionally enable auto-renewal.

After the purchase completes, the bandwidth plan appears on the tab.带宽包结果

1.4 Configure bandwidth for cross-region communication

  1. On the Instances page, click the ID of your CEN instance.

  2. On the Basic Information tab, click Bandwidth Plans, then click Allocate Bandwidth for Inter-region Communication.

  3. On the Connection with Peer Network Instance page, configure the parameters and click OK.

    ParameterDescription
    Instance typeSelect Inter-region Connection.
    RegionSelect the region of the source instance. In this example, select China (Beijing).
    Transit routerCEN automatically identifies the transit router for the selected region.
    Peer regionSelect the region of the destination instance. In this example, select China (Hangzhou).
    Transit routerCEN automatically identifies the transit router for the peer region.
    Bandwidth allocation modeSelect how to allocate bandwidth. Valid values: Allocate from Bandwidth Plan and Pay-By-Data-Transfer. In this example, select Allocate from Bandwidth Plan.
    Bandwidth planSelect the bandwidth plan associated with your CEN instance. Required only when Bandwidth allocation mode is Allocate from Bandwidth Plan.
    BandwidthEnter the bandwidth in Mbit/s.
    Default line typeSelect Platinum or Gold. Platinum is only available when Bandwidth allocation mode is set to Pay-By-Data-Transfer.

After the configuration is saved, the cross-region connection appears in the list.设置带宽包

Step 2: Configure the source instance

2.1 Add the destination VPC CIDR block to the IP address whitelist

Add the CIDR block of the destination instance's VPC to the source instance's IP address whitelist. For configuration steps, see Configure an IP address whitelist.

To find the VPC CIDR block of the destination instance:

  1. Go to the Instances page in the ApsaraDB RDS console and click the destination instance ID.

  2. In the left-side navigation pane, click Database Connection. The Network Type field shows the VPC CIDR block.VPC网段

2.2 Create a privileged account on the source instance

The migration requires a privileged account with the CREATE ROLE, REPLICATION, and pg_monitor permissions. If a privileged account already exists, skip this step.

To create one, see Create an account. Set Account Type to Privileged Account.

Step 3: Configure the destination instance and run the migration

3.1 Run the feasibility assessment

  1. Go to the Instances page and click the destination instance ID.

  2. In the left-side navigation pane, click Cloud Migration/DR Construction, then click the Feasibility assessment tab.

  3. In the Configure Scenario and Source Type step, set Scenario to Migration to Cloud and Source to ApsaraDB RDS Instance. Click Next.

  4. In the Configure Destination Instance step, click Next.

  5. In the Configure Source Instance step, select all listed items and click Next. Complete any listed preparations before proceeding.

  6. In the Start Feasibility Assessment step, configure the source instance details.

    ParameterDescription
    Migration task nameAuto-generated. No change needed.
    Source VPC/DNS IPInternal endpoint of the source instance. See View and change the endpoints and port numbers.
    Port of source instanceInternal port number of the source instance. See View and change the endpoints and port numbers.
    UsernameUsername of the privileged account on the source instance.
    PasswordPassword of the privileged account on the source instance.
  7. Click Create Feasibility Assessment Task.

Note

During the assessment, the destination instance status changes to Maintaining Instance.

After the assessment completes, check the result in the Migration to Cloud section of the Feasibility assessment tab:

3.2 Start the cloud migration task

  1. In the left-side navigation pane, click Cloud Migration/DR Construction, then click the Migration to Cloud tab. Click Create Cloud Migration Task.

  2. In the Create Cloud Migration Task dialog box, select the successful assessment task from the Associated Assessment Task drop-down list. ApsaraDB RDS automatically fills in Migration Source Type, Source IP/DNS, Source Port, and Username.

  3. Click Initiate Migration to Cloud.

Important

During migration, the destination instance status changes to Migrating Data In. You can read from and write to the source instance during this time. Do not migrate data from or to the source instance, restart it, or change its specifications until the migration is complete.

3.3 Switch workloads to the destination instance

  1. Click the link in the Cloud Migration Phase column to monitor task progress.

  2. When the task enters the incremental data synchronization phase, click the switchover button in the Actions column.

  3. In the Switchover dialog box, stop writes to the source instance. You can either configure the source instance to accept only read requests, or stop the connected application from writing data. To make the source instance read-only:

    1. Set the rds_force_trans_ro_non_sup parameter to on. See Modify the parameters of an ApsaraDB RDS for PostgreSQL instance.

    2. Run the following SQL statement to terminate all existing sessions:

    SELECT pg_terminate_backend(pid) FROM pg_stat_activity
    WHERE usename not in ('replicator', 'monitor', 'pgsql', 'aurora') AND pid != pg_backend_pid();
  4. Select all check boxes and click Switch Now. Wait for the migration to complete.

What to do next

After migration, reconnect your applications to the destination instance. To avoid modifying application connection strings, configure the destination instance to use the same endpoints and whitelists as the source instance:

  1. Update the whitelist: Copy the source instance's IP address whitelist settings to the destination instance. See Configure an IP address whitelist.

  2. Swap the endpoints: Change the endpoints so the destination instance uses the connection address that your applications point to. See View and change the endpoints and port numbers. For example, if the source endpoint is pgm-aaa.pg.rds.aliyuncs.com and the destination endpoint is pgm-bbb.pg.rds.aliyuncs.com: Your applications now connect to the destination instance without any code changes.

    1. Change the source instance endpoint from pgm-aaa.pg.rds.aliyuncs.com to a temporary value, for example pgm-ccc.pg.rds.aliyuncs.com.

    2. Change the destination instance endpoint from pgm-bbb.pg.rds.aliyuncs.com to pgm-aaa.pg.rds.aliyuncs.com.