post image January 6, 2022 | 1 min Read

Connecting to PostgreSQL via Cloud SQL Proxy

**Download a postgresql cloud sql proxy binary''

wget -O cloud_sql_proxy
chmod +x cloud_sql_proxy

**Open this tunnel in one terminal window''


./cloud_sql_proxy  -credential_file=$GOOGLE_APPLICATION_CREDENTIALS -instances=wadzpay-dev:europe-west3:wadzpay-dev-eu-tf=tcp:

**Connect to SQL instance (with private IP only) from your local''

psql -h --username=postgres --port=5432 --dbname=postgres

**New Firewall rule (default allow) is necessary If having a dedicated VPC''

gcloud compute --project=wadzpay-dev firewall-rules create wadzpat-dev-private-allow-internal --direction=INGRESS --priority=65535 --network=wadzpay-dev-private --action=ALLOW --rules=tcp:0-65535,udp:0-65535,icmp --source-ranges=
author image

Jan Toth

I have been in DevOps related jobs for past 6 years dealing mainly with Kubernetes in AWS and on-premise as well. I spent quite a lot …

comments powered by Disqus