Using the Cloud SQL Auth proxy to connect to multiple instances code example
Example: Using the Cloud SQL Auth proxy to connect to multiple instances
# Start the Cloud SQL Auth proxy to connect to two different Cloud SQL instances # Give the Cloud SQL Auth proxy a unique port on your machine to use for each Cloud SQL instance. ./cloud_sql_proxy -instances=myProject:us-central1:myInstance=tcp:5432,myProject:us-central1:myInstance2=tcp:1234 # Connect to "myInstance" using port 5432 on your machine: psql -U myUser -h 127.0.0.1 --port 5432 # Connect to "myInstance2" using port 1234 on your machine: psql -U myUser -h 127.0.0.1 --port 1234