
Answer-first summary for fast verification
Answer: Invalidate the CloudFront cache.
## Explanation The correct answer is **C. Invalidate the CloudFront cache**. ### Why this is the correct solution: 1. **CloudFront caching behavior**: When CloudFront is configured in front of an S3 bucket hosting a static website, it caches content at edge locations to improve performance and reduce latency. This means that even when the source files in S3 are updated, CloudFront may continue to serve the cached (old) versions to users. 2. **The problem described**: The CI/CD pipeline is successfully deploying updates to S3 (confirmed by successful deployment messages), but users are not seeing the updates on the website. This is a classic CloudFront caching issue. 3. **Cache invalidation solution**: To force CloudFront to fetch fresh content from the origin (S3), you need to invalidate the cache. This can be done by: - Creating an invalidation for specific files or paths - Using wildcards (e.g., `/*`) to invalidate all content - Configuring automatic cache invalidation as part of the CI/CD pipeline ### Why the other options are incorrect: - **A. Add an Application Load Balancer**: This would not solve the caching issue. ALB is for distributing traffic to multiple targets, not for cache management. - **B. Add Amazon ElastiCache for Redis or Memcached**: This is for database caching, not for static website content caching. The problem is with CloudFront's edge caching, not database performance. - **D. Use AWS Certificate Manager (ACM) to validate the website's SSL certificate**: SSL certificate validation is unrelated to content updates and caching issues. ### Best practices for this scenario: 1. **Automate cache invalidation**: Configure the CI/CD pipeline to automatically invalidate CloudFront cache after successful deployments. 2. **Use versioned objects**: Consider using versioned object names or query string parameters to force cache misses. 3. **Configure cache TTLs**: Adjust CloudFront cache TTL settings based on how frequently content changes. 4. **Use CloudFront cache behaviors**: Set up different cache behaviors for different types of content (e.g., shorter TTL for dynamic content, longer for static assets).
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
A company has a static website that is hosted on Amazon CloudFront in front of Amazon S3. The static website uses a database backend. The company notices that the website does not reflect updates that have been made in the website's Git repository. The company checks the continuous integration and continuous delivery (CI/CD) pipeline between the Git repository and Amazon S3. The company verifies that the webhooks are configured properly and that the CI/CD pipeline is sending messages that indicate successful deployments.
A solutions architect needs to implement a solution that displays the updates on the website.
Which solution will meet these requirements?
A
Add an Application Load Balancer.
B
Add Amazon ElastiCache for Redis or Memcached to the database layer of the web application.
C
Invalidate the CloudFront cache.
D
Use AWS Certificate Manager (ACM) to validate the website's SSL certificate.