gcloud storage cp 不适用于较大的文件

问题描述 投票:0回答:1

我正在尝试使用 gcloud storage cp 命令将大文件复制到 gcp 存储桶。该命令对于较小的文件运行良好。但它会带来较大文件的权限问题。

gcloud storage cp test.csv   gs://bkt/testbucket/file.csv --project projectid
  Completed files 0 | 0B
ERROR: (gcloud.storage.cp) User [serviceaccount.com] does not have permission to access b instance [bkt] (or it may not exist): serviceaccount.com does not have storage.buckets.get access to the Google Cloud Storage bucket. Permission 'storage.buckets.get' denied on resource (or it may not exist).

错误消息没有意义。但我尝试过减小文件大小,效果很好。

storage gcloud gsutil cp gcloud-cli
1个回答
0
投票

首先请确保存储桶存在

然后您可以尝试授予所需权限,例如

gsutil iam ch user:[email protected]:objectCreator \
              domain:www.my-domain.org:objectViewer gs://ex-bucket

或根据要求

 gsutil iam ch \
    serviceAccount:[email protected]:objectAdmin \
    gs://bkt

请参阅 向 a-gcp-service-account 授予完整的 gcs-bucket-permissionsiam#ch-examples

此外,正如您所说(如果一切正确),您能够上传小尺寸文件,只有较大的文件才会出现问题。 我知道后台可能发生了一些事情,很可能是拒绝政策,值得考虑。

拒绝政策如何运作

拒绝策略由拒绝规则组成。每个拒绝规则指定 以下:

1.A set of principals that are denied permissions

2.The permissions that the principals are denied, or unable to use

3.Optional: The condition that must be true for the permission to be denied

当委托人被拒绝许可时,他们不能做任何事情 需要该权限,无论他们担任什么 IAM 角色 的确。这是因为 IAM 始终检查相关的拒绝策略 在检查相关允许政策之前。详情请参阅政策 评价。

您可能想查看条件概述

© www.soinside.com 2019 - 2024. All rights reserved.