【发布时间】:2020-12-07 05:22:58
【问题描述】:
我正在使用以下代码将文件上传到 s3:
s3.meta.client.upload_file(file_location, bucket_name, key,ExtraArgs={'ACL': 'public-read'})
当我使用 ACL:公开读取时,我的代码返回以下错误,我无权执行此操作。
"errorMessage": "Failed to upload test.xlsx: An error occurred (AccessDenied) when calling the PutObject operation: Access Denied"
"errorType": "S3UploadFailedError"
以下是附加到我的用户的 IAM 策略。
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "s3:*",
"Resource": "*"
}
]
}
【问题讨论】:
-
您是否尝试过授予 PutObjectAcl 访问权限? AWS 错误消息有点无用。
-
@JohnnesSouza 我是 AWS 新手,所以我不熟悉那是什么。
-
我认为您的存储桶可能没有配置正确的权限。过去我有同样的问题,必须将其设置为公开,以便我能够上传一些内容。检查here了解更多信息。
标签: python amazon-s3 aws-lambda amazon-iam