I have a GCP project running Cloud SQL and a Django App inside a Google App Engine Flexible Environment and it works fine. However, when I try to connect to the same Cloud SQL instance from another project it doesn't work since the socket is not being created as specified by the cloud_sql_instances in app.yaml:
runtime: custom
env: flex
automatic_scaling:
min_num_instances: 1
beta_settings:
cloud_sql_instances: myproject:myzone:mydbinstance
env_variables:
SQLALCHEMY_DATABASE_URI: >-
postgresql+psycopg2://myuser:mypass@/mydb?host=/cloudsql/myproject:myzone:mydbinstance
Steps to reproduce:
- Create a GCP project A
- Create a Cloud SQL postgres instance in project A
- Deploy an app to app engine flexible environment in project A, following this steps to connect the app to Cloud SQL: https://cloud.google.com/appengine/docs/flexible/python/using-cloud-sql-postgres
- SSH into the instance in project A (via web console)
$ ls /cloudsql/
-> should show the socket file- Create a GCP project B
- Deploy the same app to app engine flexible environment in project B, following this steps to connect and authorize the app to project A's Cloud SQL: https://cloud.google.com/appengine/docs/flexible/python/using-cloud-sql-postgres
- SSH into the instance in project B (via web console)
$ ls /cloudsql/
-> the directory is empty, the socket is not there.
How can I get project B to show the socket?