All Products
Search
Document Center

ApsaraDB RDS:(Optional) Configure an ECS security group

Last Updated:Nov 28, 2025

You can use the one-click cloud migration feature of RDS PostgreSQL to migrate a self-managed PostgreSQL database from an ECS instance to an RDS PostgreSQL instance. This topic describes how to configure the security group for the self-managed PostgreSQL database to allow the RDS PostgreSQL instance to access the database port.

Prerequisites

The ECS instance that hosts your self-managed PostgreSQL database must meet the following requirements:

  • The ECS instance and the RDS PostgreSQL instance are in the same VPC.

  • A PostgreSQL database is deployed on the ECS instance.

Procedure

  1. Log on to the ECS console.

  2. In the navigation pane on the left, choose Instances & Images > Instances.

  3. In the top navigation bar, select a region.

  4. Find the target ECS instance and click its instance ID.

  5. On the Security Groups tab, click the ID of the security group.

  6. On the Security Group Details page, go to the Rules section. On the Inbound tab, click the Add Rule button to add the rules described in the following table.

    The following table describes the protocols and key parameters for the rules to add.

    Protocol

    Destination (This Instance)

    Source

    All ICMP

    No configuration is required. The default is All(-1/-1).

    Set this parameter to the VPC CIDR Block of the RDS PostgreSQL instance.

    How to find the VPC CIDR block

    1. Log on to the ApsaraDB RDS console and go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the instance ID.

    2. In the navigation pane on the left, click Database Connection. In the Network Type section, view the VPC CIDR block.VPC网段

    Custom TCP

    Set this parameter to the port of the self-managed PostgreSQL database on the ECS instance. You can run the netstat -a | grep PGSQL command to view the port.

What to do next

Configure the postgresql.conf file