You need to enable JavaScript to run this app.
RDS for PostgreSQL

RDS for PostgreSQL

Copy page
Download PDF
Quick start
Connecting an instance
Copy page
Download PDF
Connecting an instance
After adding the PostgreSQL instance's IP allowlist, you can successfully connect to the instance. This topic describes the procedure to connect to a PostgreSQL instance via a client or command line.​
Prerequisites​
  • An instance is created and in the Running state. For more details, refer to Creating an instance.​
  • If you are using an ECS instance for connection, please associate a private network and subnet to the instance.​
Procedure​
  • Method 2: Connect the instance via the command line.​
  1. Log on to the server that needs to connect to PostgreSQL, such as an ECS instance or local server.​
tip​
For details on how to log on to an ECS, refer to Log on to an ECS instance.​
  1. Use the command line to establish a connection.​
Once PostgreSQL is installed on the server, you can connect to the PostgreSQL database with the command line tool in the following method:​
​
psql -h <连接地址> -p <端口> -U <用户名> -d <数据库名称>​
​
danger​
Please use lower-case letters for ports (-p).​
Refer to the following table for a description of addresses and ports for PostgreSQL instances.​
​
Option​
Note​
Example​
-h​
The private or public network address of the PostgreSQL instance. For information on how to get the private or public address, refer to Connecting to an instance via private network and Applying for or releasing a public network address.​
postgresbcc087e73689****.rds-pg.ivolces.com​
-p​
Port number of the PostgreSQL instance. You can connect to PostgreSQL instances after adding IP address allowlists to the PostgreSQL instances. This topic describes how to connect to a PostgreSQL instance via the client and command line tool. You can connect to PostgreSQL instances after adding IP address allowlists to the PostgreSQL instances. This topic describes how to connect to a PostgreSQL instance via the client and command line tool.​
5432​
-U​
Account name in the PostgreSQL instance.​
testuser​
-d​
Name of the database to log on to. Note: you can omit "-d" and enter the database name only.​
db01​
​
Example command:​
​
psql -h postgresbcc087e73689****.rds-pg.ivolces.com -p 5432 -U testuser -d db01​
​
​
​
Last updated: 2025.11.17 20:31:12