Can't connect to Postgres Google Cloud SQL via psql

3,139 views
Skip to first unread message

throw away

unread,
Jul 4, 2019, 1:35:14 PM7/4/19
to Google Cloud SQL discuss
I followed the steps in this guide: https://cloud.google.com/sql/docs/postgres/connect-admin-ip

When I enter
psql "sslmode=disable dbname=postgres user=postgres hostaddr=[INSTANCE_IP]"

I get 
psql: could not connect to server: Connection timed out (0x0000274C/10060)
        Is the server running on host "INSTANCE_IP" and accepting
        TCP/IP connections on port 5432?

I have white listed my IP address and added a user which I am using to connect.

Julie (cloud platform support)

unread,
Jul 4, 2019, 4:06:29 PM7/4/19
to Google Cloud SQL discuss
Please ensure you have install the psql client and configure access to your instance, if you have not done so already. 

Please note that the connection example given is for connecting without SSL is this correct? If so Cloud Shell connections do not support SSL so connecting using the psql client in the Cloud Shell to connect to the instance will confirm if the issue is with the access configuration with the instance or the psql client. 


throw away

unread,
Jul 8, 2019, 6:36:17 AM7/8/19
to Google Cloud SQL discuss
I added my IP address to the authorized networks. I am able to connect via the Cloud shell

Julie (cloud platform support)

unread,
Jul 8, 2019, 9:54:42 AM7/8/19
to Google Cloud SQL discuss
Thanks for confirming. I suggest going back and checking with the first 2 steps: install the psql client and configure access to your instance as running locally means that psql client needs to be installed and the instance will need to be configured to be accessed from the local machine. 

Specifically from the error message, it seems there is an issue with firewall rules related to port 5432 as detailed by this Stackoverflow post. Since the issue occurs when running locally I suggest checking that there is nothing on the client end that would block the connection with the Cloud SQL instance. The connection timeout would be expected in this case, the connection is attempted until a timeout constraint is hit. 


Reply all
Reply to author
Forward
0 new messages