6

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

1

2 Answers 2

15

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks @John Rotenstein
11

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.

3 Comments

Thanks, it was the inbound rules on the security group for me!
Thank you @Trang Pham! In my case I had cloned a CodePipeline but wanted its EC2 instance to connect to a new RDS database. I had forgotten to change the EC2 instance's Security Group to match the one containing the inbound rule on the new db. Hint - make sure you choose the security group listed under Source for the Inbound Rule, not the security group assigned to the RDS itself!
You should still have Publicly Accessible = Yes if you connect outside of VPC network. You still can use Security Group. Inbound rule to limit ingress connections

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.