So here is the situation:
- I have a Bucket B. It is owned by account A_1
- This bucket has public read access on everything (through the bucket policy AND through the ACL. I put both just to try, with no result)
- This bucket can be written into by account A_2, only with the bucket-owner-full-control ACL
- The bucket is configured to serve objects through Cloudfront
--> Files uploaded by A_2 correctly give full control to A_1 when browsing in the S3 console
BUT - Cloudfront gets an access denied on the A_2 owned files (works well on A_1 owned files) - using the S3 web url, I can access the A_1 owned files (public ACL on the bucket) but not the A_2 owned
QUESTION: Why isn't the bucket policy applying to the files owned by A_2 on which A_1 has FULL_CONTROL?
NOTE - I was able to "circumvent" the problem by creating an access identity for my cloudfront and asking A_2 to specifically give read to the cloudfront canonical account ID but that's cumbersome.
Bucket policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Grant read access to the world",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my_bucket/*"
},
{
"Sid": "Grant write access to other account user",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::8566072xxxxx:root"
},
"Action": [
"s3:ListBucket",
"s3:PutObject"
],
"Resource": [
"arn:aws:s3:::my_bucket/*",
"arn:aws:s3:::my_bucket"
]
}
]
}