This topic describes how to connect to an ApsaraDB RDS for PostgreSQL instance. After you complete the initial configurations, you can connect to your RDS instance from an Elastic Compute Service (ECS) instance or your computer.
You can connect to an RDS instance by using Data Management (DMS) or a client such as pgAdmin 4.
You can log on to DMS from the ApsaraDB RDS console and then connect to an RDS instance.
DMS offers an integrated solution for data, schema, and server management, user authorization, security audit, trend analysis, data tracking, business intelligence (BI) charts, and performance analysis and optimization. In DMS, you can manage relational databases such as MySQL, SQL Server, and PostgreSQL databases. You can also manage NoSQL databases such as MongoDB and Redis databases.
You can also use a client to connect to an RDS instance. ApsaraDB RDS for PostgreSQL is fully compatible with open source PostgreSQL. You can connect to an ApsaraDB RDS for PostgreSQL instance in the similar way that you connect to an open source PostgreSQL instance. This topic uses the pgAdmin 4 client as an example. You can also adopt this method when you use other clients. When you connect to an RDS instance by using a client, you must select the internal or public endpoint of the RDS instance based on your network environment:
- If the client runs on an ECS instance that resides in the same region and has the same network type as the RDS instance, use the internal endpoint. For example, if the ECS and RDS instances both reside in virtual private clouds (VPCs) of the China (Hangzhou) region, use the internal endpoint to establish a secure connection.
- In other situations, use the public endpoint.
Use DMS to connect to an RDS instance
Log on the ApsaraDB RDS console, find the RDS instance to which you want to connect, and go to the Databases page. On the Databases page, find the database that you want to manage, and click SQL Query in the Actions column. On the logon page of DMS, enter the logon information as prompted to connect to the RDS instance.
For more information, see Use DMS to log on to an ApsaraDB RDS for PostgreSQL instance.
Use the pgAdmin 4 client to connect to an RDS instance
- Add the IP address of the pgAdmin client to an IP address whitelist of the RDS instance. For more information, see Configure a whitelist for an ApsaraDB RDS for PostgreSQL instance.
- Start the pgAdmin 4 client.
Note If the pgAdmin client runs a later version and you log on the pgAdmin client for the first time, you must specify a master password that is used to protect the saved passwords and other credentials.
- Right-click Servers and choose .
- On the General tab of the Create - Server dialog box, enter the name of the server where the pgAdmin client runs.
- Click the Connection tab and enter the information that is used to connect to the RDS instance.
Parameter Description Hostname/address Enter the endpoint of the RDS instance. If you want to connect to the RDS instance over an internal network, enter the internal endpoint of the RDS instance. If you want to connect to the RDS instance over the Internet, enter the public endpoint of the RDS instance. For more information, see View and change the internal and public endpoints and port numbers of an ApsaraDB RDS for PostgreSQL instance. Port Enter the port number that is associated with the endpoint. Username Enter the username of the account that you use to log on to the RDS instance. Password Enter the password of the account that you use to log on to the RDS instance.
- Click Save.
- If the information that you entered is correct, the following page appears, which
indicates that the connection to RDS instance is successful.
Note The postgres database is the default system database of the RDS instance. Do not perform operations on this database.
How do I obtain data from ApsaraDB RDS to Function Compute?
You can install third-party dependencies on Function Compute. Then, you can use these built-in dependencies to obtain data from ApsaraDB RDS.For more information, see Install third-party dependencies.