How to connect to Cloud SQL from pgAdmin4?

Viewed 2483

I have an instance of PostgreSQL 11 in GCP as Cloud SQL. I want to connect pgAdmin to the server but I don't know to what port. Where can I see that?

I don't want to specify my ip adress for the server and I whitelisted all the connections to the server by putting 0.0.0.0/0 as an ip in the gcp console.

1 Answers

Multiple methods can be used to connect Cloud SQL to external applications such as pgAdmin. Here is the documentation covering all the methods and the steps to follow. Since you do not wish to specify your ip address, then using the proxy might be a good alternative. Documentation guidelines for that method can be found here, but here is a quick summary:

  1. Enable the API
  2. Install the proxy client on your local machine
  3. Determine how you will authenticate the proxy
  4. If required by your authentication method, create a service account
  5. Determine how you will specify your instances for the proxy
  6. Start the proxy
  7. Update your application to connect to Cloud SQL using the proxy
Related