Connect to remote postgresql server on amazon ec2

In this table:

5432      0.0.0.0/32    Delete
5433      0.0.0.0/32    Delete
6432      0.0.0.0/32    Delete 

the CIDRs look like you're not allowing any IP in. Shouldn't they be 0.0.0.0/0 instead, like what you have for port 22 (ssh)?


I Found the resolution to this problem. Two things are required.

  1. Use a text editor to modify pg_hba.conf. Locate the line host all all 127.0.0.1/0 md5. Immediately below it, add this new line: host all all 0.0.0.0/0 md5

  2. Editing the PostgreSQL postgresql.conf file:

    Use a text editor to modify postgresql.conf. Locate the line that starts with #listen_addresses = 'localhost'. Uncomment the line by deleting the #, and change localhost to *. The line should now look like this: listen_addresses = '*' # what IP address(es) to listen on;.

Now Just restart your postgres service and it will connect