[RDS Postgres] failed: Connection timed out

0

Hi, I have multiples postgres database instance on RDS, but, for some reason, out of nowhere, some of them now have no public connection, without any active intervention. What is weird is that I can still connect to some instances with psql. Both instances (the ones I can connect and the ones I can't) have the same:

  • Security Groups (with my ext ip as an inbound rule to postgres)
  • Publicly accessible: Yes
  • VPC
  • Subnets
  • Availability Zone

And their DNS looks ok, which I verified with:

$ nslookup ########.rds.amazonaws.com
Server:         ###.###.###.###
Address:        ###.###.###.######

Non-authoritative answer:
##########.rds.amazonaws.com     canonical name = ##########.amazonaws.com.
Name:   ##########.amazonaws.com
Address: ###.###.###.###

But, when checking with

$ nc -zv ##########.rds.amazonaws.com ####

I get "succeeded" from one, and "nc: connect to ###.###.###.### port #### (tcp) failed: Connection timed out" from the other.

1 réponse
0
Réponse acceptée

Hello.

Is there a route to the Internet gateway configured in the subnet where RDS is running?
For example, are all the subnets set in the subnet group public subnets?
https://repost.aws/knowledge-center/rds-connectivity-instance-subnet-vpc
https://repost.aws/knowledge-center/rds-cannot-connect

By the way, public access of RDS is not recommended for security reasons, so I think it is better to connect using Session Manager's port forwarding function as introduced in the document below.
https://aws.amazon.com/jp/blogs/mt/use-port-forwarding-in-aws-systems-manager-session-manager-to-connect-to-remote-hosts/

profile picture
EXPERT
répondu il y a un mois
profile pictureAWS
EXPERT
vérifié il y a un mois
  • Hi, There are 3 private subnets and 3 public subnets on this vpc, all 3 public subnets are targeting an internet gateway. The thing is, I can access a database on the same VPC, with the same subnets with the same configurations. About the second solution, we plan on doing it later, but right now I need a fast solution because there are multiple external services accessing my database. It was working, but out of nowhere it stopped working for only some instances, so we need to fix this legacy structure before migrating to another. Is there some configuration specific to each rds instance that needs to be configured? Like inserting its ip somewhere?

  • Update: the other ones also stopped working. I will look into everything again.

  • It looks like my instance has an ip that is outside the range of the vpc

  • In the end made it work using the ssh tunnel with an ec2. Maybe the problem was the private and public subnets inside the same vpc. Thanks!

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions