You can use the one-click cloud migration feature to migrate a self-managed PostgreSQL database from an ECS instance to ApsaraDB RDS for PostgreSQL. To do this, configure the security group of the ECS instance to allow the ApsaraDB RDS for PostgreSQL instance to access the port of your self-managed database.
Prerequisites
Your ECS instance must meet the following conditions:
-
The ECS instance and the ApsaraDB RDS for PostgreSQL instance must be in the same VPC.
-
A PostgreSQL database must be deployed on the ECS instance.
Procedure
-
Log on to the ECS console.
-
In the left-side navigation pane, choose .
-
In the upper-left corner of the top menu bar, select a region.
-
Find the target ECS instance and click its instance ID.
-
On the Security Group tab, click the security group ID.
-
On the Security Group Details page, in the Rules section, click the Add Rule button on the Inbound tab to add the following rules.
The following table describes the required parameters.
Protocol
Destination
Access Source
All ICMP
Leave this parameter at its default value: All(
-1/-1).Set this to the VPC CIDR Block of the ApsaraDB RDS for PostgreSQL instance.
Custom TCP
Set this to the port of the self-managed PostgreSQL database on the ECS instance. You can run the
netstat -a | grep PGSQLcommand to find the port.