1
votes

I have an EC2 Ubuntu machine that is trying to establish a connection to Postgress RDS Machine. I have allowed all outbound traffic for my ec2 machine. for inbound for RDS, I have allowed all UDP, all TCP, and all ICMP Ipv4 traffic with source as a security group of EC2 machine.

I feel my EC2 is not able to connect to the RDS instance. Both are in the same default VPC.

I tried :

ping hostname 

from my EC2, which doesn't connect and also tried

 psql yellow-pages -U yp_develop -h hostname Password

I get

psql: FATAL:  database "yellow-pages" does not exist

anything that I am missing or I understood the concept wrongly that I am not able to solve this issue.

Please if anyone cloud solve this problem.

1
Ping won't work to RDS, but does it at least resolve the hostname? Does it resolve it to a public ip or a private ip? Does running telnet hostname 5432 connect to your DB?Chris Williams
hey, @ChrisWilliams hope you're doing well. I tried running telnet it gave the below output Trying 172.31.21.223... Connected to ec2-15-185-178-141.me-south-1.compute.amazonaws.com. Escape character is '^]'.sumanth shetty
OK great so that actually connected to the RDS instance, right can you confirm running psql -U yp_develop -h hostname -l Password? This should list all databases that existChris Williams
@ChrisWilliams getting a weird error when I try the this command "psql: FATAL: database "password" does not exist"sumanth shetty
got it I was running wrong syntax, forgot to put YP_SUPPLIERS within " ". :Dsumanth shetty

1 Answers

1
votes

The database is connectable by attempting to use telnet to connect to it.

The issue appeared to be that either the user does not have permission to the database yellow-pages or the database yellow-pages does not exist.

To validate this the telnet $HOSTNAME 5432 command was run and it was able to connect.

After this the psql -U yp_develop -h $HOSTNAME -l command was carried out validating that there was no yellow-pages database setup on this RDS instance.