A SysOps administrator is configuring an Amazon CloudFront distribution to serve static content from an Amazon S3 bucket. The administrator must secure the content so that viewers can only access the files through CloudFront, preventing direct access to the S3 bucket. Which action should the administrator take to meet this security requirement?
- Enable origin access control (OAC) on the CloudFront distribution and update the S3 bucket policy to allow read access to the CloudFront service principal.Answer
- BConfigure an Elastic Load Balancing health check on the S3 bucket to verify that only CloudFront requests are accepted, routing traffic to a backup bucket if access is direct.
- CAttach an IAM policy to the CloudFront distribution that uses the iam:PassRole action to delegate access to the S3 bucket.
- DSet up an S3 Gateway Endpoint in the VPC and associate it with the subnet route tables used by CloudFront edge locations to bypass the public internet.
Answer
Enable origin access control (OAC) on the CloudFront distribution and update the S3 bucket policy to allow read access to the CloudFront service principal.
Enabling origin access control (OAC) on the CloudFront distribution and updating the S3 bucket policy to allow read access to the CloudFront service principal restricts direct S3 access. OAC signs the requests sent to S3 using AWS Signature Version 4, and the bucket policy permits access only when the request is signed by the designated CloudFront distribution.
Step-by-Step Solution
Key Concept
Securing an Amazon S3 origin using CloudFront Origin Access Control (OAC)