Google App Engine – Connect App to MySQL in Cloud SQL Using Internal IP

google-app-engine

1 – Have a MySQL instance on Google Cloud SQL, with internal IP 10.22.etc (no external/public IP)
2 – Have a Java Web App deployed to Google App Engine, with internal IP 10.140.etc (no external/public IP)

How can I get 1 & 2 on the same network, or to at least be able to use a JDBC connection from my Java Web App to my MySQL, without using a public IP.

Don't see anywhere in the console(s), eclipse plugin or docs on how to do this. Is Google Cloud really making everyone use public IP's to connect from App Engine standard to Google Cloud SQL? If so, is this because both are fully managed PaaS's?

Best Answer

If you use the app engine flexible environment, it gets hosted on an instance in your private network, giving you access to internal IPs.

I'm assuming you're on the standard environment. Here's a decent link I've found telling you the differences between the two -> https://cloud.google.com/appengine/docs/flexible/java/migrating

to switch you need to ensure you set env to flex on your app.yaml file.

runtime: java
env: flex
Related Topic