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

Cloud Sql Proxy Private IP External application


Simple question: Is there any way to connect to a GCP SQL Database under private IP through cloud sql proxy from an external application ? (local development environment)

I followed every step in the official tutorial to configure cloud sql proxy with all requirements, but all connections fail in a sort of timeout.


Solution

  • In order to connect to a Cloud SQL instance using only private IP through the Cloud SQL proxy will be to install the proxy within a resource (could be for example a Compute Engine instance) with access to the same VPC network as the Cloud SQL instance. Since your local development environment might not comply to that requirement the connection will fail.

    You could move your local development environment to a compute engine instance located within the same VPC network as your Cloud SQL instance or temporarily enable Public IP on the instance and authorize only your IP through the authorized network options and use the Cloud SQL proxy to gain access to the instance.