title: Amazon EC2: PostgreSQL remote connection hangs
body: <p>I'm trying to set up PostgreSQL remote connection on Ubuntu server.</p>
  
  <p>I changed <code>listen_addresses = 'localhost'</code> to <code>listen_addresses = '*'</code> in  <code>/etc/postgresql/9.3/main/postgresql.conf</code></p>
  
  <p>Then I added to postgre config file <code>/etc/postgresql/9.3/main/pg_hba.conf</code> lines</p>
  
  <p><code>host    all             all             0.0.0.0/0               md5
  host    all             all             ::0/0                   md5
  host    all             all             all                     md5
  </code></p>
  
  <p>But when I'm trying to connect remote DB by <code>psql -U db_user -h host -d db_name</code> it hangs and show message </p>
  
  <p><code>psql: could not connect to server: Connection timed out
      Is the server running on host "host_address" and accepting
      TCP/IP connections on port 5432?</code></p>
  
  <p>PgAdmin connection hangs as well</p>