2

I am having a problem starting proxy for Google SQL.

I installed proxy like this:

$ wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64

$ mv cloud_sql_proxy.linux.amd64 cloud_sql_proxy

$ chmod +x cloud_sql_proxy

$ sudo mkdir /cloudsql; sudo chmod 777 /cloudsql

Problem is when I try to run proxy:

$ ./cloud_sql_proxy -dir=/cloudsql -instances=myproject:us-central1:mydb

I receive error message:

googleapi: Error 403: Request had insufficient authentication scopes., forbidden

I enabled Google API as described in documentation. Both 'Compute Engine' and 'Cloud SQL' are in the same project. I expected there will be no need to additional authentication.

Please advise.

Thank you.

John-no1
  • 61
  • 4
  • What scopes do you have enabled on Compute Engine? What roles/permissions are assigned to the Compute Engine service account? Edit your question with these details. – John Hanley May 17 '19 at 16:10
  • @JohnHanley - Thank you for the suggestion. I managed to fix the problem thanks to it. It was a problem with scopes indeed (Compute Engine > VM instance details > Cloud API access scopes). – John-no1 May 18 '19 at 12:34
  • @John-no1 did you only enable the Cloud SQL APi or all? – fokusfocus May 19 '20 at 01:36

1 Answers1

4

Thanks to John Hanley's suggestion, I fixed the problem.

Issue was with missing permissions for API. I added them here: Compute Engine > VM instance details > Cloud API access scopes. Permission for all APIs was disabled and after enabling them, I was able to successfully run Google SQL proxy.

John-no1
  • 61
  • 4