Cloud-SQL-Proxy - Error 403: boss::NOT_AUTHORIZED:

I need help connecting into a Postgres SQL via Cloud-SQL-Proxy. 

Here is what I have: 

1. I created SQL instance, and created a DB and a user on the instance itself. I added the user and DB from the web console. 

2. I am able to log into the DB using Cloud SQL Studio, but I need to access the DB from my local. So, I tried Cloud-SQL-Proxy.  

3. I initiate the proxy with "./cloud-sql-proxy --port 5225 CONNECTION-NAME". It's start fine. But when I tried to connect to it with the username and password that work on Cloud SQL Studio, I am getting this error:  failed to connect to instance: failed to get instance: Refresh error: failed to get instance metadata (connection name = "stg-icognition:us-central1:psql-icog-stg"): googleapi: Error 403: boss::NOT_AUTHORIZED: Not authorized to access resource. Possibly missing permission cloudsql.instances.get on resource instances/psql-icog-stg., forbidden

I am assuming that I am missing something in the configuration, but I couldn't find difference between my set-up in the docs - https://cloud.google.com/sql/docs/postgres/connect-auth-proxy

 

 

 

Solved Solved
2 1 151
1 ACCEPTED SOLUTION

I was able to solve this problem by downloading the JSON key from the service account and used when starting the proxy. 

Here is an example: ./cloud-sql-proxy --credentials-file stg-icognition-b1a2c25b03fd.json --port 5223 [INSTENCE_CONNECTION_NAME]

View solution in original post

1 REPLY 1

I was able to solve this problem by downloading the JSON key from the service account and used when starting the proxy. 

Here is an example: ./cloud-sql-proxy --credentials-file stg-icognition-b1a2c25b03fd.json --port 5223 [INSTENCE_CONNECTION_NAME]