通过CloudFront Origin Access Identity通过CloudFront将文件上传到s3存储桶已成功运行,但是我的AWS账户的根用户无法修改上传文件的属性,并且某些元数据也无法访问。我可以通过CloudFront端点获取文件,但是我不明白为什么我无法通过AWS管理控制台通过我的AWS根帐户修改或访问上载文件的某些字段。
s3存储桶中的默认ACL是针对root用户帐户的,如下所示:
我在存储桶中添加了第二个策略,以确保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上传的文件时,在“文件概述”选项卡上收到许多选项的拒绝访问:
答案 0 :(得分:3)
您需要在通过CloudFront链接进行的PUT / POST调用中传递ACL "Bucket-owner-full-control",并修改CloudFront的Bucket策略以允许您使用PutobjectACL。