You have an application deployed in AWS, and a CloudFront distribution is configured to deliver the content.
Clients can use the application to get files from an S3 bucket. You need to restrict access to the files because the content is intended for selected users.
You have already associated an origin access identity with the CloudFront distribution, and users cannot bypass CloudFront to access S3 files. Which methods can you use to serve the private content for CloudFront? (Select TWO.)
Click on the arrows to vote for the correct answer
A. B. C. D. E.Answer - B and E.
Option A is incorrect because HTTPS is not enough to limit access.
It needs the application to determine if a user can access specific files.
Option B is CORRECT because the application can return a signed URL to the user which allows the user to download or stream the content.
Access to the URL and permission on the file can be made which permits limited and required access only.
Option C is incorrect because AWS WAF is a web application firewall that helps protect your web applications or APIs against common web exploits that may affect availability, compromise security, or consume excessive resources but cannot be used to serve private contents in CloudFront.
Option D is incorrect because users cannot bypass CloudFront to access S3 files as per the current setup.
The S3 bucket policy should already be configured to limit the CloudFront OAI.
Option E is CORRECT because AWS CloudFront signed cookies enable you to control who can access the content.
Reference:
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.htmlTo serve private content for CloudFront, we need to make sure that users can't bypass CloudFront to directly access files in the S3 bucket. We also need to ensure that only selected users can access the content.
Given that an origin access identity has already been associated with the CloudFront distribution, users cannot bypass CloudFront to access S3 files. This ensures that requests for the content must go through CloudFront first.
To serve private content for CloudFront, we can use two methods:
Develop the application to determine whether a user should have access to the content and create CloudFront signed URLs: In this method, the application controls access to the content in S3. The application checks whether a user is authorized to access the content and creates a signed URL that grants temporary access to the content. The signed URL includes an expiration time and can only be used by the authorized user. CloudFront verifies the signed URL before serving the content. This method ensures that only authorized users can access the content.
Configure the S3 bucket policy only to allow the CloudFront origin access identity to read files on the bucket: In this method, the S3 bucket policy is configured to allow read access only to the CloudFront origin access identity. CloudFront requests the content from S3 using the origin access identity, and S3 only grants access if the request comes from the origin access identity. This method ensures that only CloudFront can access the content.
In addition to these methods, we should also configure the CloudFront distribution to require HTTPS to request objects in S3 to ensure secure communication between the users and CloudFront. We can also use AWS WAF in the CloudFront distribution to monitor HTTP and HTTPS requests and control access to the content in S3. Additionally, we can use CloudFront signed cookies to grant temporary access to the content based on application logic.
Overall, to serve private content for CloudFront, we can use a combination of these methods to ensure that only authorized users can access the content, and all requests for the content must go through CloudFront.