默认 Compute Engine 服务帐户无法访问 Cloud SQL

Default Compute Engine service account cant access Cloud SQL

我正在尝试让我的计算引擎实例使用代理与云 SQL 通信。当我尝试启动代理时,我不断收到此错误:

the default Compute Engine service account is not configured with sufficient permissions to access the Cloud SQL API from this VM. Please create a new VM with Cloud SQL access (scope) enabled under "Identity and API access". Alternatively, create a new "service account key" and specify it using the -credentials_file parameter

当我使用 gcloud compute instances describe 描述我的实例时,服务帐户和范围是:

serviceAccounts:
- email: 123456-compute@developer.gserviceaccount.com
  scopes:
  - https://www.googleapis.com/auth/devstorage.full_control
  - https://www.googleapis.com/auth/logging.write
  - https://www.googleapis.com/auth/monitoring.write
  - https://www.googleapis.com/auth/sqlservice
  - https://www.googleapis.com/auth/sqlservice.admin

如果我创建一个具有完整范围权限的新实例,我可以使它正常工作:

serviceAccounts:
- email: 123456-compute@developer.gserviceaccount.com
  scopes:
  - https://www.googleapis.com/auth/cloud-platform

但这似乎不如仅指定我需要的范围安全。

这是一个已在 https://github.com/GoogleCloudPlatform/cloudsql-proxy/pull/21 中修复的问题。

我们将在星期一 (4/18) 推出新版本。或者您可以从 github 上的源代码进行编译。抱歉给您带来不便。