Search code examples
google-cloud-platformgoogle-cloud-sql

How do I share a Google Cloud SQL privately outside its region


Not finding any solid answers that fit within the scope of my question.

I have a custom VPC established to allow communication between my SQL server and instance groups. My issues are limited connectivity to the SQL server from instances within the same region as the server itself.

Basically, I created a Cloud SQL instance within us-east region.

When I create a VM Instance within the same region as the SQL instance, I have no issues connecting to its private IP.

mysql -h{PRIVATE_IP} -uroot

However, running this same command from an instance in a different region results in a timeout. Both instances are configured the exact same and within the same VPC network.

I let Google allocate IP address pool for me when I created the IP. Created the private network connection within my custom VPC settings and tried tutorials provided in the Cloud Console documentation itself with no luck.

Any help getting me on the right track would be much appreciated. Thank you.


Solution

  • As documented, if you want to connect Cloud SQL from a Compute Engine instance using private IP, your instance must be in the same region as your Cloud SQL instance.

    Keep in mind that your Cloud SQL instances are not created in your VPC network, those are created in a Google internal VPC network that then is peered to your VPC network.

    Hope this helps!