0

I configure a serverless vpc,& launch the app with following app.yaml. But unable to communicate the private sql instance.

runtime: python37
service: xxxx
entrypoint: gunicorn main:app --bind 0.0.0.0:$PORT --worker-class sanic.worker.GunicornWorker

vpc_access_connector:
  name: "projects/xxxx/locations/us-central1/connectors/serverless-vpc-name"

inbound_services:
- warmup

env_variables:
  PROJ_NAME: xxxxx
  DB_TYPE: mysql_socket
  SQL_USERNAME: root
  SQL_PASSWORD: xxxxx
  SQL_DATABASE_NAME: xxxxx
  SQL_CONNECTION_NAME: xxxx:us-central1:cloudsql-instance```


Aniket
  • 495
  • 1
  • 5
  • 16

1 Answers1

0

According to official documentation link:

If you are connecting from App Engine, you must use flexible environment. You cannot use private IP to connect from standard environment.

Here you can find more documentation Connecting to Cloud SQL from App Engine

However you can use Serverless VPC Access to connect from your App Engine app directly to Cloud SQL instances, and any other resources with an internal IP address.

Connecting to a VPC network

marian.vladoi
  • 7,663
  • 1
  • 15
  • 29
  • is it any option to deploy app in standard environment ? – Aniket Dec 12 '19 at 09:04
  • there is no option with private IP from standard – marian.vladoi Dec 12 '19 at 09:13
  • if we deploy the app in "env: flex" with 'vpc_access_connector:' from app.yaml file, it should be connected. right ? – Aniket Dec 12 '19 at 09:23
  • you can find here a related question [link](https://serverfault.com/questions/985982/how-to-connect-app-in-google-app-engine-to-mysql-in-cloud-sql-using-internal-ip) – marian.vladoi Dec 12 '19 at 09:42
  • yes , you can connect using vpc_access_connector [link](https://cloud.google.com/vpc/docs/configure-serverless-vpc-access) – marian.vladoi Dec 12 '19 at 09:57
  • any new feature deployed Google recently against standard environment app-engine and sql-instance communication via private ip ? – Aniket Jan 08 '20 at 11:45