Note : This is for Laravel/PHP setup only (should work with other stacks, but not tested)
- Setup a Cloud SQL instance
- Setup a Cloud Run service
- Connect the Cloud SQL instance to Cloud Run service under "connections"
- Add environment variables (directly or via secret manager) as per the specifications mentioned here: https://cloud.google.com/sql/docs/postgres/connect-run?authuser=1#connecting_to
- For Laravel, the DB_HOST ENV VAR should be of the format :
/cloudsql/project-id:region-id:db-instane-name
- Additionally, add "Cloud SQL Client" role to the default compute account (Under IAM)