gsutil是否支持使用服务帐户信息创建boto文件?

Chr*_*idt 7 boto google-cloud-storage service-accounts google-cloud-platform

根据几个示例,gsutil config可用于从服务帐户的OAuth2凭据创建与GCS兼容的.boto文件.

例如,httpsgsutil config -e://cloud.google.com/storage/docs/xml-api/gspythonlibrary 建议您使用服务帐户凭据来配置.boto文件; 但是,当运行该命令时,我得到:

CommandException: OAuth2 is the preferred authentication mechanism 
with the Cloud SDK. Run "gcloud auth login" to configure authentication, 
unless you want to authenticate with an HMAC access key and secret, 
in which case run "gsutil config -a".
Run Code Online (Sandbox Code Playgroud)

按照说明,我尝试使用gcloud auth activate-service-account:

$ gcloud auth activate-service-account --key-file=/Users/crschmidt/mirandum-local/cloud-storage-service.json 
Activated service account credentials for: [gcs-storage@livestream-alerts.iam.gserviceaccount.com]
Run Code Online (Sandbox Code Playgroud)

但这不会创建.boto文件.

我可以在互操作性模式下配置可互操作的HMAC项目ID /秘密并使用它,但由于首选OAuth2凭据,并且服务帐户凭证似乎是正确的方法,我不知道如何继续.如何为服务帐户编写.boto文件?

crschmidt-macbookair:~ crschmidt$ gsutil --version
gsutil version: 4.19
Run Code Online (Sandbox Code Playgroud)

Mik*_*rtz 4

gcloud 将凭据存储在 ~/.config/gcloud 下的文件中(而不是 .boto),然后在使用 gsutil 时将它们传递给 gsutil。