gpt4 book ai didi

amazon-s3 - s3api getobject 权限被拒绝

转载 作者:行者123 更新时间:2023-12-02 23:38:39 26 4
gpt4 key购买 nike

我正在尝试使用 aws-cli 从 s3 获取文件

aws s3api get-object --bucket <bucket_name> --key /foo.com/bar/summary-report-yyyymmdd.csv.gz temp_file.csv.gz --profile <profile_name>

但我收到以下错误 -

An error occurred (AccessDenied) when calling the GetObject operation: Access Denied

我已经使用重新检查了我的配置

aws configure --profile <profile_name>

那里的一切似乎都是正确的。我使用相同的凭据在 S3 浏览器上浏览和获取文件,没有任何问题。

文档的用处很小,因为我对此存储桶的访问权限非常有限。我无法验证权限或使用

aws s3 --profile <profile_name> ls

最佳答案

AccessDenied 可能意味着您没有权限,但如果对象不存在,则会返回错误(您可以阅读 here 了解使用此错误的原因)

您可以使用aws s3api list-objects命令确保您有权访问存储桶,例如

aws s3api list-objects --bucket <bucket_name> --query 'Contents[].{Key: Key, Size: Size}' --profile <profile_name>

在您的情况下,问题很可能出在 key 前面的 / 用户

aws s3api get-object --bucket <bucket_name> --key foo.com/bar/summary-report-yyyymmdd.csv.gz temp_file.csv.gz --profile <profile_name>

关于amazon-s3 - s3api getobject 权限被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42997200/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com