0

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.

millenion
  • 1,218
  • 12
  • 16

2 Answers2

1

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.

Daniel Ocando
  • 3,554
  • 2
  • 11
  • 19
  • Yes, the short answer will be no. The answer is that the proxy should be located within a resource on the same VPC as your instance if you mean to connect to it using only Private IP. – Daniel Ocando Nov 17 '20 at 13:19
0

The Cloud SQL proxy will work with a private IP address as long as it can reach the private IP address.

See the "Connecting from an external source" section on the Configuring Private IP page for a list of steps to set up a VPN that can provide access to your VPC.

kurtisvg
  • 3,412
  • 1
  • 8
  • 24