Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create Google cloud SQL MySQL read replica on a different project

I am currently trying to access a Cloud SQL database from another team as to be able to query it via BigQuery federated queries.

Sadly, as they are in a different project than my BigQuery data warehouse, I cannot use federated queries.

The solution I envisioned would be to simply create a read replica of this database on my project, and use federated queries on it.

Even though the documentation does not seem to forbid this, there does not seem to be any documentation about how to proceed with this.

I have tried using the gcloud command:

gcloud sql instances create <my-replica> --master-instance-name <source instance> --project <source project>

The one above creates a read replica, but in the source project which is no use for me

gcloud sql instances create <my-replica> --master-instance-name <source instance> --project <destination project>

This one raise a 404 as it seems to be looking for an instance named inside of the .

Is there a straightforward way of creating this read replica instance that I am missing ?

The only other way I managed to find in the documentation would be to create my replica as external replica, but it seems far harder to configure.

like image 538
LoicM Avatar asked Sep 17 '25 11:09

LoicM


1 Answers

If you are simply trying to create the federated query, you do not need to create a replica. Have the other team establish a view utilizing the federated query in their project, and grant your SA or user access. You can then query their view which stores the connection information. This way you avoid the issue of the federated query being in the same project as the Cloud SQL instance.

like image 76
Daniel Zagales Avatar answered Sep 19 '25 02:09

Daniel Zagales