Home:ALL Converter>Connecting to Google Cloud SQL PostgreSQL using Cloud Shell with SSL?

Connecting to Google Cloud SQL PostgreSQL using Cloud Shell with SSL?

Ask Time:2018-06-12T23:36:02         Author:Don Seiler

Json Formatter

I've set up a PostgreSQL instance on Google Cloud SQL and have set it up now to only allow SSL connections. I'm able to connect from my workstation via psql and from some apps like R Studio.

However I'm trying to connect via the GCloud Shell and don't seem to see any options to connect with SSL. There are options to manage certifications and I've created another client key and downloaded the files for it in my cloud shell account, I just don't see options for using them to make a connection. Without it just tells me there isn't an HBA for a "No SSL" connection.

Here is what I see (some things obfuscated):

don@cloudshell:~ (xxx)$ gcloud sql connect foo --user=postgres
Whitelisting your IP for incoming connection for 5 minutes...done.
Connecting to database with SQL user [postgres].Password for user postgres:
psql: FATAL:  connection requires a valid client certificate
FATAL:  pg_hba.conf rejects connection for host "a.b.c.d", user "postgres", database "postgres", SSL off

Author:Don Seiler,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/50820938/connecting-to-google-cloud-sql-postgresql-using-cloud-shell-with-ssl
yy