AWS RDS: How to Connect to an Instance

I just installed an Amazon RDS instance. I have a separate application server and am trying to figure out how to connect to an RDS instance from my EC2 application server. On the instance page I have

enbdpoint: mycompany.czdv3mj7ps25.us-west-2.rds.amazonaws.com:5432 

I tried logging into psql using this address, but I got

 $ psql -h mycompany.czdv3mj7ps25.us-west-2.rds.amazonaws.com:5432 -U myuser -d mydb psql: could not translate host name "mycompany.czdv3mj7ps25.us-west-2.rds.amazonaws.com:5432" to address: Name or service not known 

How to connect to instance database? I do not see any other IP addresses in the RDS console.

+6
source share
2 answers

You have the wrong syntax. The correct syntax is:

 $ psql --host mycompany.czdv3mj7ps25.us-west-2.rds.amazonaws.com --port 5432 --username myuser --dbname mydb 

You have provided port incorrect information in your command. port must be specified using the --port option, not hostname:port

+14
source

This syntax worked for me on the psql command line:

\ connect dbname username hostname port #

If the information is correct, it will take a few seconds to process, then it will ask for your password

Also make sure the security group for your outbound / inbound instance is configured to allow access from your IP

0
source

Source: https://habr.com/ru/post/958814/


All Articles