【问题标题】:IAM Policy not allowing me to upload to S3IAM 政策不允许我上传到 S3
【发布时间】: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


【解决方案1】:

Amazon S3 阻止公共访问会阻止应用任何允许对 S3 存储桶中的数据进行公共访问的设置。目前 ACL 操作被拒绝。

请开启 Permissions >> Block Public access

中的“阻止对通过新访问控制列表 (ACL) 授予的存储桶和对象的公共访问”设置

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-10-31
    • 2020-05-24
    • 2013-10-25
    • 2018-01-03
    • 2018-12-07
    • 1970-01-01
    • 2021-11-07
    • 1970-01-01
    相关资源
    最近更新 更多