我确定我已授予我可以授予的所有权限:
louchenyao@dev ~> gcloud auth list
Credentialed Accounts
ACTIVE ACCOUNT
* 290002171211-compute@developer.gserviceaccount.com
louchenyao@gmail.com
To set the active account, run:
$ gcloud config set account `ACCOUNT`
louchenyao@dev ~> curl -H 'Metadata-Flavor: Google' "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/scopes"
https://www.googleapis.com/auth/devstorage.read_write
https://www.googleapis.com/auth/logging.write
https://www.googleapis.com/auth/monitoring.write
https://www.googleapis.com/auth/service.management.readonly
https://www.googleapis.com/auth/servicecontrol
https://www.googleapis.com/auth/trace.append
louchenyao@dev ~> gsutil cp pgrc.sh gs://hidden-buckets-name
Copying file://pgrc.sh [Content-Type=text/x-sh]...
AccessDeniedException: 403 Insufficient Permission
并且我已将Storage Admin授予云计算默认帐户。
如果我切换到个人帐户,则可以使用。所以我想知道我是否错过了一些重要的权限。
答案 0 :(得分:0)
使用默认服务帐户授予访问权以从VM实例写入存储桶: change API access scopes for the VM instance,请按照以下步骤操作:
Stop
实例VM instance details
> Edit
Cloud API access scopes
> Storage: Full
Save
进行更改并启动实例还可以在控制台的Identity and API access
部分中设置access scopes创建VM实例
如果您不想使用默认服务帐户create new service account for your VM Instance,并使用它来访问存储桶。