Search code examples
wordpressgoogle-app-enginegoogle-cloud-sqlgoogle-vpc

Connect Wordpress on Google App Engine with CloudSQL internally


I installed Wordpress in App Engine Standard following Community tutorial from Google Cloud website.

I noticed that this configuration uses the external IP address to connect to from App Engine to the database in Cloud SQL.

Is it possible to get both communicated by its internal addresses?

Both App Engine and Cloud SQL are in the same project and in the same region.


Solution

  • To establish connection to a Cloud SQL instance thru a private IP in App Engine Standard, you need to create a Serverlesss VPC Access connector in the same VPC network as your Cloud SQL instance. Here are the steps:

    1. Make sure that the Cloud SQL instance you created has a private IP address. If you need to add one, see the Configuring private IP page for instructions.

    2. Create a Serverless VPC Access connector in the same VPC network as your Cloud SQL instance. Unless you're using Shared VPC, a connector must be in the same project and region as the resource that uses it, but the connector can send traffic to resources in different regions.

    3. Connect using your instance's private IP and port 3306. Use TCP to connect directly to the Cloud SQL instance without using the Cloud SQL Auth proxy.