Jan Walraven
DevOps



Menu
Categories:
Posted on

It’s possible to connect the Google Cloud SQL proxy to another projects Cloud SQL instance.

Google Project Configuration

Project A

  1. Google Cloud SQL instance.
  2. IAM role roles/cloudsql.client for the service account from project B sql-proxy@project-b.iam.gserviceaccount.com

Project B

  1. Activate API Cloud SQL Admin API
  2. Service account sql-proxy@project-b.iam.gserviceaccount.com
  3. VM instance running on the service account sql-proxy@project-b.iam.gserviceaccount.com

VM instance config


$ wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 -O cloud_sql_proxy
$ chmod +x cloud_sql_proxy
$ ./cloud_sql_proxy -instances=project-a:region:mysql-instance-name=tcp:3306