Reputation: 145
I have a Django app deployed on App Engine.
Inside the same project, I've set up a MySQL instance set up with a Private IP.
Side Note: I've been using this DB to do local development, and can connect to it via my laptop as I whitelisted the IP address, so I know I can at least connect to it.
Per the instructions on the instruction guide found here: https://cloud.google.com/sql/docs/mysql/connect-app-engine-standard
I have done the following:
All failed, but in different ways.
The Private IP at least gave me a Django Debug error saying "x.x.x.x could not be connected to via MySQL."
The 127.0.0.1 gave me the same error.
10.8.0.0 gave me a "502 Bad Gateway (nginx) error.
I don't know what I'm doing wrong. The instructions aren't clear to me. This line is especially confusing:
"Create a Serverless VPC Access connector in the same VPC network as your Cloud SQL instance."
How do I know/find out which VPC network my Cloud SQL instance is in? I go to VPC networks and I see the "internal IP ranges" column, and the region where I've deployed the Cloud SQL resource is something like 10.171.0.0. Is that the VPC network?
Upvotes: 0
Views: 685
Reputation: 1207
I just tested the documentation you are working with, and I did not get any error message with a Private IP.
Something important that you should have in mind are the requirements for Private IP and, optionally, you can specify an allocated IP range for your instances to use for connections, expand the “show allocated IP range” option, and select an IP range from the drop-down menu.
To review which VPC network your Cloud SQL instance is in, you need to select your VPC Network and then review the column for instances.
Upvotes: 1