I am trying to connect to a GCP Postgres Cloud SQL instance from a GCP Google App Engine flexible environment in a separate GCP project. I am using Python.
The instructions indicate that this requires adding the default App Engine service account as an IAM member in the Postgres Cloud SQL project.
The docs go on to state:
Once deployed, your application uses the Cloud SQL Proxy that is built in to the App Engine flexible environment to communicate with your Cloud SQL instance.
However, I've had no luck successfully connecting to Cloud SQL from GAE. I've tried several varieties of host addresses (e.g. localhost
, <external-ip-address>
, /cloudsql/<INSTANCE_CONNECTION_NAME>
etc.) but nothing seems to work.
Several questions come to mind:
Do I need to manually provide a service account key to the GAE instance?
What is the actual host location of the Cloud SQL instance for connection parameters or DSN strings? The docs refer to
/cloudsql/<INSTANCE_CONNECTION_NAME>
though I've had no luck with this.Do I need to create a shared network to link the projects?