Skip to content

Can't connect to AWS postsql RDS

0

I'm trying to stand up a Dev database for a web app. I have setup the Dev database using a snapshot from the current prod server. I'm currently trying to restore the dev server's DB from a .dmp file I have via:

psql --host=blahblahblahblah.us-east-1.rds.amazonaws.com --port=5432 --username=postgres --password --dbname <dbname> -f backup.s

Which gives me the error:

psql: error: connection to server at "awseb-e-gjem7uperk-stack-awsebrdsdatabase-1hzzq9r4a74c.cg7ksxih0nnz.us-east-1.rds.amazonaws.com" (3.225.21.170), port 5432 failed: Operation timed out Is the server running on that host and accepting TCP/IP connections?

I believe I have followed all the recommended steps to debug.

  1. Check that the host name used is the DB instance endpoint and that the port number used is correct - yes, they are correct. I copied directly from the RDS Connectivity & security page.

  2. Make sure that the DB instance's public accessibility is set to Yes

  3. Make sure that the user connecting to the database has CONNECT access to it - (THIS ONE I'M NOT SURE ABOUT How can I do this if I can't connect?)

  4. Check that the security group assigned to the DB instance has rules to allow access - I have access to everybody. I know it's not best practice, but I'm trying to get it to work right now

Any ideas what is causing me to not connect?

Check out my post on stackoverflow for additional context/images: https://stackoverflow.com/questions/76553853/cant-connect-to-aws-postsql-rds

1 Answer
0
Accepted Answer

By the looks of the screenshots in your stackoverflow post, the instance has been recovered into a subnet group with 12 subnets. But the routing table only has six subnets associated with it.

Has the database has been recovered into, and is running in, only those subnet(s) that are publicly accessible and have a route to the internet gateway? We can't tell this from just the info provided (here and stackoverflow).

It may be worth using Reachability Analyser, which can be customised to work with RDS https://aws.amazon.com/blogs/database/troubleshoot-network-connectivity-to-amazon-rds-databases-using-vpc-reachability-analyzer/

EXPERT
answered 2 years ago
AWS
EXPERT
reviewed 2 years ago
EXPERT
reviewed 2 years ago
EXPERT
reviewed 2 years ago
  • Yep, I had to add the other subnet into the routing table. Thank you!!

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.