I created a basic test PostgreSQL RDS instance in a VPC. It is public and VPC security group. The security group whose configuration is as follows: Inbound Rule: Type: PostgreSQL Protocol: TCP Port:5432 Source: Outbound: Type: All Protocol: All Port: All Destination:

When I try to connect, it fails. Here's the error code that I get: could not connect to server: Connection timed out Is the server running on host () and accepting TCP/IP connections on port 5432?

I m doing this for the first time so please help me out. Any help will be appreciated.

  • What’s the IP or endpoint DNS name? Exactly as is please, not redacted.
    – MLu
    Aug 10, 2019 at 9:31
  • I think including screen shots of the RDS instance, security group setup, and a ping of an EC2 instance in the same subnet would be valuable for diagnosis. That would show, for example, that you have an internet gateway attached to the VPN and a routing table set up to route to the internet.
    – Tim
    Aug 10, 2019 at 18:24

1 Answer 1


I'm a bit late, but for those looking on in the future:

I encountered this error and looked up every possible solution: VPC connection, security groups, changing my pg_hba.conf and postgresql.conf files, making sure my program was publicly accessible, etc.

My problem was that I was using Python 3.7 as my runtime on AWS lambda, and Pyton 3.8 uploaded into S3 bucket dependencies! It took me way too long to figure this out. Live and learn, I guess!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.