2

Every time I connect to postgresql database I authorize my IP in Google Cloud. As I am going to use AWS(it gives a new IP on every connection), I want to automatically authorize those IPs. So how can I do it? Is there any certificate or json files that I can use for this?

0

1 Answer 1

1

The most secure way to do it would be to use the Cloud SQL proxy, which allows you to connect without Authorized IPs.

Another, less secure way would be to use the Cloud SQL Admin API to authorize your IP address as needed - you can use gcloud or a REST call to programmatically do this as needed. Please note that:

  1. The IP will be authorized until removed, even if you stop using it
  2. Configuring new authorized networks replaces any existing authorized networks. You'll either need to GET the current list and append (but be wary of race conditions!) OR use a shared value store to make sure the list of IPs is currently up to date.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.