我认为这样做会很直接,但我无法让它工作:
我正在尝试将文件从服务器 (GCE) 推送到谷歌云存储桶。为了避免gsutil
在服务器上授予命令太多权限,我在我的 google 项目的凭据部分创建了一个“服务帐户”。
在存储桶中,gs://mybucket
我已将具有 OWNER 权限的服务帐户的电子邮件地址作为 USER 添加到存储桶中。
在服务器上,我像这样激活了服务帐户:
$gcloud auth activate-service-account --key-file <path-to-keyfile> myservice
$gcloud auth list
Credentialed accounts:
- 1234567890@project.gserviceaccount.com
- myservice (active)
To set the active account, run:
$ gcloud config set account <account>
Run Code Online (Sandbox Code Playgroud)
所以到目前为止一切似乎都很好。但是,访问存储桶失败:
$gsutil cp tempfile gs://mybucket
CommandException: Error retrieving destination bucket gs://mybucket/: [('PEM routines', 'PEM_read_bio', 'no start line')]
$gsutil cp tempfile gs://mybucket/tempfile
Failure: [('PEM routines', 'PEM_read_bio', 'no start line')].
Run Code Online (Sandbox Code Playgroud)
当然,我确实验证了存储桶的 ACL 确实将服务帐户显示为 OWNER。我也在不同操作系统的不同机器上尝试过这个。结果一样。不用说,我自己无法理解错误消息。我将不胜感激任何建议。此要点中的详细错误日志。
更新:
删除 …
google-app-engine cloud-storage oauth google-cloud-storage google-cloud-platform
oauth ×1