All Products
Search
Document Center

How do I locate the IP address connected to an RDS for PostgreSQL or RDS for PPAS instance?

Edit in GitHub
Last Updated: Jul 21, 2020 Edit in GitHub

Description

After the public IP address of the local server is added to the IP address whitelist of the RDS instance, the instance cannot be accessed, while the other servers can access the instance. In this scenario, the local server can still access the RDS instance after you set the IP address whitelist to your company's CIDR block or 0.0.0.0/0.

 

Causes

The public IP address of the local server added to the whitelist is incorrect.

 

Solutions

Alibaba Cloud reminds you that:

  • When you perform operations that have risks, such as modifying instance configurations or data, check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
  • Before you modify the configurations and data of instances including but not limited to ECS and RDS instances, we recommend that you create snapshots or enable RDS log backup.
  • If you have authorized or submitted security information such as the logon account and password in the Alibaba Cloud Management console, we recommend that you modify such information in a timely manner.

This topic applies only when you access the RDS instance from a device other than ECS. If you access the RDS instance from an ECS instance, you can find the public and private IP addresses of the ECS instance on the ECS console.

  1. Add the 0.0.0.0/0 route entry to the RDS PostgreSQL or PPAS whitelist. For more information, see set a whitelist.
  2. Use the pgAdmin4 client RDS PostgreSQL or RDS PPAS instance.
  3. Click database, Select postgres, and click tools> query Tool.
  4. Run the following SQL statement to view the displayed results query the value of the column is SELECT the corresponding client_addr the IP column, that is, the local device public network IP.
    select datname, pid, usename,client_addr, client_hostname, client_port,query from pg_stat_activity;
  5. Delete the route entry 0.0.0.0/0 that you added to the whitelist in step 1, and add the real public IP address of the route.

 

References

If the public IP address of your local device changes and the established connection is used in a production environment, we recommend that you use a private connection instead or configure a reasonable public IP address in the whitelist. Ensure that the connection is not disconnected due to a change in the IP address.

 

Application scope

  • ApsaraDB RDS for PostgreSQL
  • ApsaraDB RDS for PPAS