通过AWS控制台访问Root帐户时使用CloudFront 403上传的文件错误

时间:2019-10-22 18:01:15

标签: amazon-web-services amazon-s3 amazon-cloudfront

通过CloudFront Origin Access Identity通过CloudFront将文件上传到s3存储桶已成功运行,但是我的AWS账户的根用户无法修改上传文件的属性,并且某些元数据也无法访问。我可以通过CloudFront端点获取文件,但是我不明白为什么我无法通过AWS管理控制台通过我的AWS根帐户修改或访问上载文件的某些字段。

s3存储桶中的默认ACL是针对root用户帐户的,如下所示:

AWS s3 ACL Tab

我在存储桶中添加了第二个策略,以确保root用户具有对文件的显式访问权限。完整的存储桶策略如下所示:

{
    "Version": "2008-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "AWS": [
                    "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity 00000000000000"
                ]
            },
            "Action": [
                "s3:PutObject",
                "s3:GetObject"
            ],
            "Resource": [
                "arn:aws:s3:::my-bucket/stuff/",
                "arn:aws:s3:::my-bucket/stuff/*",
                "arn:aws:s3:::my-bucket/other-stuff/",
                "arn:aws:s3:::my-bucket/other-stuff/*"
            ]
        },
        {
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::000000000000:root"
            },
            "Action": "s3:*",
            "Resource": [
                "arn:aws:s3:::my-bucket/stuff/",
                "arn:aws:s3:::my-bucket/stuff/*",
                "arn:aws:s3:::my-bucket/other-stuff/",
                "arn:aws:s3:::my-bucket/other-stuff/*"
            ]
        }
    ]
}

当我查看通过CloudFront上传的文件时,在“文件概述”选项卡上收到许多选项的拒绝访问:

AWS S3 Bucket File Overview Tab

我还从同一文件的“文件属性”选项卡中收到了更多“拒绝访问”信息: AWS S3 Bucket File Properties Tab

1 个答案:

答案 0 :(得分:3)

您需要在通过CloudFront链接进行的PUT / POST调用中传递ACL "Bucket-owner-full-control",并修改CloudFront的Bucket策略以允许您使用PutobjectACL。