2

I'm aware of similar topics. After applying the solution that has worked for many I'm still stuck with the same error.

My RDS db instance with open port 5432:

enter image description here

EC2 instance in which the db instance resides. Please note inbound rules applied:

enter image description here

The error I'm getting when SSHing into EC2 instance and trying to access database on RDS:

enter image description here

What debugging steps I can perform here ?

Update:

The source now reflects IP of the RDS instance:

enter image description here

mr_incredible
  • 837
  • 2
  • 8
  • 21
  • 1
    The address in your error message is `18.132.64.139` but your database endpoint resolves to `172.31.41.230` (which btw shouldn't be public and open to the internet). You haven't shown any code so we can only guess why your database address was incorrect. – jordanm Apr 30 '20 at 17:15
  • The only reason why I exposed the database to public is because it worked for others. I didn't have it like that to begin with. Get the same error anyway. I removed the other rules and left db to be open to the IP of the instance only. The error hasn't gone away. – mr_incredible Apr 30 '20 at 17:43
  • Btw where did you get 172.31.41.230 ? When I typed in the endpoint it didn't resolve to that IP. – mr_incredible Apr 30 '20 at 17:57
  • `dig usersdbprod.cey46tfgaz8v.eu-west-2.rds.amazonaws.com +short` – jordanm Apr 30 '20 at 17:58
  • @jordanm short what ? – mr_incredible Apr 30 '20 at 18:00
  • That's part of the command – jordanm Apr 30 '20 at 18:02
  • https://dnschecker.org/#A/usersdbprod.cey46tfgaz8v.eu-west-2.rds.amazonaws.com – jordanm Apr 30 '20 at 18:06
  • Ohh ... `dig` was a command. First time I'm seeing this. It did resolve to that IP. Am I using the wrong IP ? I mean I'm working with a course and I'm supposed to expose the port 5432 of the database to the EC2 instance's public IP which is `18.132.64.139` which is the instance I'm able to SSH into. – mr_incredible Apr 30 '20 at 18:06
  • Yes, you are using the wrong IP. looks like you are using the EC2 instance IP for the database address instead of the RDS endpoint address. – jordanm Apr 30 '20 at 18:07
  • I've added an update to my post to reflect changes. Still the same error though. – mr_incredible Apr 30 '20 at 18:46

1 Answers1

0

Had the same issue. I added IP of EC2 instance to the RDS PostgreSQL security group inbound rule with All Traffic. It worked for me.

Xavries
  • 41
  • 2
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/30166078) – lcgodoy Oct 25 '21 at 15:24