This topic describes how to connect to an RDS PostgreSQL instance. After completing the initial configuration, you can connect to your RDS instance from an ECS instance or your computer.

You can connect to an RDS PostgreSQL instance through DMS or a database client such as pgAdmin 4.

Note Only the RDS PostgreSQL instances in PostgreSQL 10 High-availability Edition (with local SSDs), PostgreSQL 10 Basic Edition, and PostgreSQL 9.4 can be connected through DMS.

Background information

You can log on to DMS through the RDS console and then access the target RDS instance.

DMS allows you to manage Linux servers, NoSQL databases, and relational databases such as MySQL, SQL Server, PostgreSQL, MongoDB, and Redis. It is an all-in-one data management service that supports data management, structure management, access security, BI charts, data trends, data trace, performance trends and optimization, and server management.

RDS PostgreSQL is fully compatible with PostgreSQL, so you can connect to RDS in the way you connect to an on-premises PostgreSQL database. This topic takes the pgAdmin 4 client as an example to introduce how to connect to an RDS instance. You can also adopt this method when using other clients. When you connect to an RDS instance through a client, choose to use an internal or public endpoint as follows:

  • Use the internal endpoint when your client is installed on an ECS instance that is located in the same region and the same network type as the RDS instance to be connected.
  • Use the public endpoint for the other situations.

Connect to an RDS instance through DMS

For more information, see Use DMS to log on to an RDS instance.

Connect to an RDS instance through a database client

  1. Add the IP address of the device to access the RDS instance to a whitelist of the RDS instance. For more information, see Configure a whitelist.
  2. Start the pgAdmin 4 client.
  3. Right-click Servers and choose Create > Server from the shortcut menu. 选择服务器
  4. On the General tab of the Create - Server dialog box, enter the server name. 创建-服务器页面
  5. Click the Connection tab and enter the information of the RDS instance to be connected. 创建-服务器页面连接页签

    Parameter description:

    • Host name/address: to the endpoint of the RDS instance. If your application accesses the RDS instance through a private network, enter the internal endpoint of the RDS instance. If your application accesses the RDS instance through the Internet, enter the public endpoint of the RDS instance. To find the endpoints and ports of the RDS instance, follow these steps:
      1. Log on to the RDS console.
      2. Select the region where the target RDS instance is located.
      3. Find the target RDS instance and click the instance ID.
      4. In the Basic Information section of the Basic Information page, find the endpoints and ports of the RDS instance.
    • Port: the port number of the RDS instance. If your application accesses the RDS instance through a private network, enter the internal port number of the RDS instance. If your application accesses the RDS instance through the Internet, enter the public port number of the RDS instance.
    • Username: the name of the premier account you use to connect to the RDS instance.
    • Password: the password of the premier account you use to connect to the RDS instance.
  6. Click Save.
  7. If the connection information is correct, choose Servers > server name > Databases > postgres. The following interface is displayed, which indicates that the connection to RDS instance is successful.
    Note Postgres is the default system database of the RDS instance. Do not perform any operation in this database.
    连接成功页面