Question 250:
You use an Amazon S3 bucket as the origin for a CloudFront distribution. To restrict access to S3 content, you create an Origin Access Identity (XXXX1234567890) in CloudFront and associate it with the distribution. You need to modify the S3 bucket policy so that users cannot bypass CloudFront to access the S3 files. Which of the following options contains the correct S3 bucket policy statement?
Answer options:
A.{
"Effect": "Deny",
"Principal": {
"AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity XXXX1234567890"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::aws-example-bucket/*"
}
B.{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::cloudfront:user/XXXX1234567890"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::aws-example-bucket"
}
C.{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity XXXX1234567890"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::aws-example-bucket/*"
}
D.{
"Effect": "Deny",
"NotPrincipal": {
"AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity XXXX1234567890"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::aws-example-bucket"
}