Google SQL Proxy connect to another project
Posted on May 8, 2019
It’s possible to connect the Google Cloud SQL proxy to another projects Cloud SQL instance.
Google Project Configuration
Project A
- Google Cloud SQL instance.
- IAM role roles/cloudsql.client for the service account from project B sql-proxy@project-b.iam.gserviceaccount.com
Project B
- Activate API Cloud SQL Admin API
- Service account sql-proxy@project-b.iam.gserviceaccount.com
- 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