I followed by cloudfront docuement http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html#private-content-granting-permissions-to-oai for private file.
The bucket policy looks like:
{
"Version": "2008-10-17",
"Id": "PolicyForCloudFrontPrivateContent",
"Statement": [
{
"Sid": "1",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity XXXXXXXXX"
},
"Action": "s3:*",
"Resource": "arn:aws:s3:::XXXXXX/*"
}
]
}
When I upload file by the signed url with KEY PAIR. The file owner is
Owner CloudFront Origin Access Identity *********
At now, I can't using boto3 in ec2. The command
aws s3 cp s3::/xxx/uploadfile test.txt
Give me a error:
fatal error: An error occurred (403) when calling the HeadObject operation: Forbidden
I can upload file which don't use the signed url. These file can be access by boto3 fine. These file owner is
****MyCountName*****
So I can't figure out why ec2
machine can't head the origin access identity
file?