Skip to content

Cloud SQL Proxy

Jim Laney edited this page Apr 1, 2021 · 3 revisions

Steps for installing cloud-sql-proxy

1. Install the Cloud SDK

1.1. Install the latest SDK
https://cloud.google.com/sdk/docs/install

1.2. Initialize the SDK by running gcloud init and follow the application instructions

1.3. Authenticate by running gcloud auth login

2. Install cloud-sql-proxy

2.1. Download Google’s latest cloud-sql-proxy binary release:
https://github.com/GoogleCloudPlatform/cloudsql-proxy/releases

For example, for Linux 64 bit run:
wget https://storage.googleapis.com/cloudsql-proxy/v1.20.1/cloud_sql_proxy.linux.amd64 -O cloud_sql_proxy
chmod +x cloud_sql_proxy

2.2. Move the cloud_sql_proxy executable to somewhere in your path so that it is discoverable

For example:
mv cloud_sql_proxy /usr/local/bin/cloud_sql_proxy

3. Run cloud_sql_proxy to establish a new connection to GCP

For example, the following command will establish a proxy connection to a Google Cloud SQL instance

cloud_sql_proxy -instances=[project-name]:[region]:[sql-instance-name]=tcp:5432

This will create a new connection socket listening on localhost:5432. Connect to this socket using the DB client / IDE of your choice (e.g. https://dbeaver.io/).

Clone this wiki locally