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:
Set up cross-region networking — Connect the source and destination VPCs through CEN so that the two instances can communicate over an internal network.
Run the feasibility assessment — Verify that the source instance is ready for migration.
Migrate data and switch over — Start the cloud migration task, then switch workloads to the destination instance when incremental data synchronization begins.
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
Log on to the CEN console.
On the Instances page, click Create CEN Instance.
In the Create CEN Instance dialog box, configure the parameters and click OK.
Parameter Description Name Enter 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://orhttps://.
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.
On the Instances page, click the ID of the CEN instance you created.
On the Basic Information tab, click the
icon to the right of the VPC count.
On the Connection with Peer Network Instance page, configure the parameters and click OK.
Parameter Description Instance type Retain the default value Virtual Private Cloud (VPC). Region Select the region of the instance whose VPC you are adding. For the source instance, select China (Beijing). Transit router No transit routers are available by default. CEN automatically creates one. Select the primary zone and secondary zone for the transit router. Resource owner ID Select Current Account. Attachment name Enter a name for the attachment. Network instance Select the VPC ID of the instance. To find the VPC ID, go to Database Connection in the ApsaraDB RDS console.
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
On the Instances page, click the ID of your CEN instance.
On the Basic Information tab, click Bandwidth Plans, then click Purchase Bandwidth Plan (Subscription).
Configure the parameters and click Buy Now to complete the purchase.
Parameter Description CEN ID The CEN instance is pre-selected. The bandwidth plan is automatically associated with it after purchase. Area A Select an area for cross-region communication. In this example, select Mainland China. NoteYou cannot change the area after the bandwidth plan is purchased.
Area B Select the other area. In this example, select Mainland China. Billing method Retain the default value Pay-By-Bandwidth. Bandwidth Specify the bandwidth in Mbit/s. Bandwidth package name Enter a name for the bandwidth plan. Order time Select 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
On the Instances page, click the ID of your CEN instance.
On the Basic Information tab, click Bandwidth Plans, then click Allocate Bandwidth for Inter-region Communication.
On the Connection with Peer Network Instance page, configure the parameters and click OK.
Parameter Description Instance type Select Inter-region Connection. Region Select the region of the source instance. In this example, select China (Beijing). Transit router CEN automatically identifies the transit router for the selected region. Peer region Select the region of the destination instance. In this example, select China (Hangzhou). Transit router CEN automatically identifies the transit router for the peer region. Bandwidth allocation mode Select how to allocate bandwidth. Valid values: Allocate from Bandwidth Plan and Pay-By-Data-Transfer. In this example, select Allocate from Bandwidth Plan. Bandwidth plan Select the bandwidth plan associated with your CEN instance. Required only when Bandwidth allocation mode is Allocate from Bandwidth Plan. Bandwidth Enter the bandwidth in Mbit/s. Default line type Select 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:
Go to the Instances page in the ApsaraDB RDS console and click the destination instance ID.
In the left-side navigation pane, click Database Connection. The Network Type field shows the VPC CIDR block.

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
Go to the Instances page and click the destination instance ID.
In the left-side navigation pane, click Cloud Migration/DR Construction, then click the Feasibility assessment tab.
In the Configure Scenario and Source Type step, set Scenario to Migration to Cloud and Source to ApsaraDB RDS Instance. Click Next.
In the Configure Destination Instance step, click Next.
In the Configure Source Instance step, select all listed items and click Next. Complete any listed preparations before proceeding.
In the Start Feasibility Assessment step, configure the source instance details.
Parameter Description Migration task name Auto-generated. No change needed. Source VPC/DNS IP Internal endpoint of the source instance. See View and change the endpoints and port numbers. Port of source instance Internal port number of the source instance. See View and change the endpoints and port numbers. Username Username of the privileged account on the source instance. Password Password of the privileged account on the source instance. Click Create Feasibility Assessment Task.
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:
Successful: Proceed to create the cloud migration task.
Failed: Click View Report in the Actions column and resolve the reported issues. For common errors, see Introduction to cloud migration assessment reports.
3.2 Start the cloud migration task
In the left-side navigation pane, click Cloud Migration/DR Construction, then click the Migration to Cloud tab. Click Create Cloud Migration Task.
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.
Click Initiate Migration to Cloud.
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
Click the link in the Cloud Migration Phase column to monitor task progress.
When the task enters the incremental data synchronization phase, click the switchover button in the Actions column.
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:
Set the rds_force_trans_ro_non_sup parameter to on. See Modify the parameters of an ApsaraDB RDS for PostgreSQL instance.
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();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:
Update the whitelist: Copy the source instance's IP address whitelist settings to the destination instance. See Configure an IP address whitelist.
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.comand the destination endpoint ispgm-bbb.pg.rds.aliyuncs.com: Your applications now connect to the destination instance without any code changes.Change the source instance endpoint from
pgm-aaa.pg.rds.aliyuncs.comto a temporary value, for examplepgm-ccc.pg.rds.aliyuncs.com.Change the destination instance endpoint from
pgm-bbb.pg.rds.aliyuncs.comtopgm-aaa.pg.rds.aliyuncs.com.