Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon RDS PostgreSQL not accepting TCP connections on port 5432

I have created a PostgreSQL Amazon RDS databaes but I cannot connect to it from my local machine.

I am connecting like this:

psql -h <db endpoint> -p 5432 -U <username> <db name>

Response is:

Is the server running on host and accepting TCP/IP connections on port 5432?

Here are the database settings:

RDS settings

Here are my security group settings:

Security group inbound rules

like image 413
Saurabh Bhatia Avatar asked Nov 30 '22 15:11

Saurabh Bhatia


2 Answers

Your configuration picture is showing a setting of Publicly Accessible = No.

You will need to modify your database to set this to Yes.

From Modifying a DB Instance Running the PostgreSQL Database Engine:

Publicly Accessible

Choose Yes to give the DB instance a public IP address, meaning that it will be accessible outside the VPC (the DB instance also needs to be in a public subnet in the VPC); otherwise, choose No, so the DB instance will only be accessible from inside the VPC.

like image 136
John Rotenstein Avatar answered Dec 04 '22 06:12

John Rotenstein


If you don't want to have Publicly Accessible = Yes then you should ensure that you've set a Security Group which has an Inbound rule. You'd have to then ensure that the security group is set up correctly.

like image 41
Trang Pham Avatar answered Dec 04 '22 04:12

Trang Pham