A media publishing platform hosts its static assets in an Amazon S3 bucket and distributes them globally via an Amazon CloudFront distribution. During a high-traffic breaking news event, the Amazon S3 bucket experiences a massive surge in read requests, leading to performance degradation and high costs. An investigation reveals that a developer set the CloudFront cache behavior TTL values to 0 to ensure that readers always receive the most up-to-date images and CSS files. Which solution should a solutions architect implement to resolve the S3 performance issue while ensuring users still receive updated assets immediately?
- AConfigure the CloudFront cache behavior to set the Minimum, Maximum, and Default TTL to 0, forcing CloudFront to forward every client request to the Amazon S3 origin to check for the latest version.
- BDeploy Amazon EC2 proxy instances in a private subnet to retrieve static assets from Amazon S3 via a NAT Gateway, and configure the application to bypass CloudFront and load assets directly from these EC2 instances.
- Configure the CloudFront cache behavior to use a Cache Policy with a long Default TTL (such as 30 days), and update the web application to use a file versioning naming convention (such as appending a unique hash to the asset filenames) whenever an asset is updated.Cevap
- DTransition the static assets in the Amazon S3 bucket to the S3 Standard-Infrequent Access (S3 Standard-IA) storage class to reduce costs, and configure the CloudFront behavior to use a Default TTL of 1 hour, overwriting S3 objects whenever they are updated.
Cevap
Configure the CloudFront cache behavior to use a Cache Policy with a long Default TTL and implement file versioning (cache-busting) in the web application for updated assets.
The correct solution uses a combination of long-term CloudFront caching (long TTL Cache Policy) and web application file versioning (cache-busting). By renaming updated assets (e.g., `image_v2.png`), the application changes the request URI. CloudFront treats the new URI as a cache miss, fetches the new version from S3, caches it, and serves subsequent requests from the edge. This guarantees that users receive updates instantly while keeping the cache hit ratio high and S3 read requests minimal.
Adım Adım Çözüm
Anahtar Kavram
CloudFront Caching and File Versioning (Cache-Busting)
Tahmini Süre:2m 0s