0
votes

I Cannot connect to AWS rds Postgresql using master password and username but pgAdmin connection with the certificate works perfectly.

My website, when it tries to connect to the database, says:

net::ERR_CONNECTION_TIMED_OUT

I ssh into my ec2 instance of the Elastic Beanstalk and it gives me the following error when I am trying to connect to the rds:

psql: error: FATAL:  PAM authentication failed for user "user"
FATAL:  pg_hba.conf rejects connection for host "111.11.1.11", user "user", database "database", SSL off

The command I use to connect is this:

psql --host=rds_endpoint --port=5432 --username=user --password --dbname=database

I changed the master password and still, it does not work.

Again, If I use pgAdming with ssl certificate and that token that it generates, the connection is successful and I have full access to the database.

Also, the command

nc -zv rds_endpoint 5432

gives the successfull result:

Ncat: Connected to 111.11.11.11:5432.