I've just set up a new Postgres 9.6 on a db.t2.small with 100gb SSD in AWS Sydney region. I can connect to it through psql and pgAdmin using the master user and password, so it has been setup correctly, and the security groups allow access. But after running a few commands it throws:

psql: could not connect to server: Operation timed out Is the server running on host "xyz.ap-southeast-2.rds.amazonaws.com" (54.xxx.xxx.xxx) and accepting TCP/IP connections on port 5432?

So given that I can connect and can issue commands like CREATE EXTENSION postgis successfully, why would it drop the connection so frequently?

I am trying to restore a 300mb dump file, but it drops connection even when running basic SELECTs, or refreshing the object list in pgAdmin. When attempting a restore, it drops connection in less than 30 seconds.

  • You're connecting to your PG instance over the public internet? Or from another host in EC2? – EEAA Jul 26 '17 at 3:23
  • Connecting direct from my workstation. Thats actually not a bad idea, I could try to connect from one of my EC2 instances in the same VPC. – JK01 Jul 26 '17 at 3:31
  • Connecting to any database server over the public internet is a very bad idea, for both security and performance reasons. Give it a try from an EC2 instance in the same VPC (you are using VPC, right?). If the problem is solved (it very likely will be), then you know where the issue lies (your internet connection). – EEAA Jul 26 '17 at 3:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.