【问题标题】:How to read from google cloud stoage buckets using service credentials json如何使用服务凭证 json 从谷歌云存储桶中读取数据
【发布时间】:2020-01-03 21:46:14
【问题描述】:

我想使用服务凭证文件使用 gsutil 从谷歌云存储中读取数据。 但是我真的不明白如何将权限文件传递给它。 我试过跑步 “gcloud auth activate-service-account [ACCOUNT] --key-file=KEY_FILE” 然后运行“gsutil list”。但是我得到以下输出

You are attempting to perform an operation that requires a project id, with none configured. Please re-run gsutil config and make sure to follow the instructions for finding and entering your default project id.

通过 gcloud 进行身份验证后,我应该能够使用 gsutil

【问题讨论】:

    标签: google-cloud-platform google-cloud-storage


    【解决方案1】:

    在您的gsutil 命令中添加-p <project id> 或执行gcloud config set project <project id> 以全局设置项目ID。

    您也可以参考this documentation 了解更多 gsutil 参数。

    【讨论】:

      【解决方案2】:

      既然你已经做了"gcloud auth activate-service-account [ACCOUNT] --key-file=KEY_FILE",那么你唯一需要做的就是gcloud config set project <project id>

      注意gsutil 中没有-p 选项

      【讨论】:

      • gsutil 中没有-p 选项,但gsutil ls 命令有一个-p。有关gsutil ls 命令的更多信息,请参阅此文档link
      • 我们如何在生产环境中访问服务凭证 json?
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-03
      相关资源
      最近更新 更多