Search code examples
gcloudgoogle-cloud-sql

Can't connect to gcloud SQL - ETIMEDOUT


I keep getting an ETIMEDOUT error when connecting to a new Google Cloud SQL postgres instance. Nothing much to explain honestly. It has a public IP with public connections enabled. I'm using the default postgres user and the initial password I set for it. I'm connecting with the IP it gives me and port 5432, and I've tried connecting from multiple different clients and get the same result.

What am I missing here?


Solution

  • By default Cloud SQL doesn't allow anyone on the internet to reach your public IP instance. Instead, you have to either configure Authorized Networks or use the Cloud SQL Proxy or a Cloud SQL Connector.

    I'd recommend either running the Cloud SQL Proxy on your machine (requires gcloud with active credentials) or to configure an Authorized Network with whatever originating IP your machine uses.

    See the docs: