Can't connect to EC2 Postgresql instance unless I change the default port 5432 I just created a brand new EC2 instance with a default security group allowing All Traffic from Anywhere.

My listen_address is set to *

I can SSH to it but I can't connect to the pgsql instance running inside it, UNLESS I change the port to something other than port=5432.

This Setup Fails:

postgresql.conf:
port=5432
psql -h &lt;public-ip&gt; -p 5432

ERROR:


  psql: could not connect to server: Operation timed out`


This works:

port=6000
psql -h &lt;public-ip&gt; -p 6000

I tried this twice in two different AWS accounts, same behavior.

no iptables rules are present either, it's a brand new EC2 instance:

ubuntu@&lt;public-ip&gt;:~$ sudo iptables -L -n
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination


This doesn't make sense to me at all.

This is the version of Ubuntu I'm running:

ubuntu@&lt;public-ip&gt;:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.2 LTS
Release:    14.04
Codename:   trusty


Postgres version:

psql (PostgreSQL) 9.3.6


The weirdest thing it was working yesterday, no changes has been made except that I upgraded to Yosemite 10.10.3 (14D136.

EDIT:

I checked with another EC2 instance in the cloud as client, it connect, it seems to be my OSX, again, since I updated to Yosemite 10.10.3

EDIT 2:

Not just psql, none of my client apps are able to connect.

EDIT 3:

"host=&lt;public-ip&gt; port=5432 sslmode=disable" didn't worked neither.

Any tips?
Doing an nmap over the EC2 instance:

nmap -Pnv -p 5432 &lt;public-ip&gt;


revealed that my ISP is intentionally blocking the port 5432(third-world country FTW...):

Host is up.
PORT     STATE    SERVICE
5432/tcp filtered postgresql


It was never a problem with EC2 nor Postgresql in first place.