AWS Certified Solutions Architect – Associate (SAA-C03) — Question 810
A company is hosting a high-traffic static website on Amazon S3 with an Amazon CloudFront distribution that has a default TTL of 0 seconds. The company wants to implement caching to improve performance for the website. However, the company also wants to ensure that stale content is not served for more than a few minutes after a deployment.
Which combination of caching methods should a solutions architect implement to meet these requirements? (Choose two.)
Answer options
- A. Set the CloudFront default TTL to 2 minutes.
- B. Set a default TTL of 2 minutes on the S3 bucket.
- C. Add a Cache-Control private directive to the objects in Amazon S3.
- D. Create an AWS Lambda@Edge function to add an Expires header to HTTP responses. Configure the function to run on viewer response.
- E. Add a Cache-Control max-age directive of 24 hours to the objects in Amazon S3. On deployment, create a CloudFront invalidation to clear any changed files from edge caches.
Correct answer: A, E
Explanation
Setting the CloudFront default TTL to 2 minutes ensures that content without explicit headers is cached briefly, meaning stale content naturally expires quickly. Additionally, setting a Cache-Control max-age of 24 hours on S3 objects enables high-performance caching, while performing a CloudFront invalidation upon deployment immediately clears any modified files from the edge caches. Other options, such as using a private Cache-Control directive, would prevent CloudFront from caching the files entirely.