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```
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.