A global logistics corporation runs a package tracking portal on AWS. The application serves static content (images, CSS, and JS files) stored in an Amazon S3 bucket, and dynamic tracking updates via an Application Load Balancer (ALB) that routes to an Amazon ECS cluster. During peak operations, the ECS cluster experiences high CPU utilization due to repetitive queries for identical, fast-changing tracking data. A solutions architect must design a high-performing content delivery and caching solution that minimizes latency for users globally while reducing the read load on both S3 and the ECS cluster. Which architecture should the solutions architect implement to meet these requirements?
- Configure an Amazon CloudFront distribution with two cache behaviors. Route the path pattern for static assets to the Amazon S3 origin with a caching-optimized policy. Route the API path pattern to the ALB origin with caching enabled and a short Time-To-Live (TTL), using the package ID query string parameter as part of the cache key.Answer
- BConfigure an Amazon CloudFront distribution with two cache behaviors. Route the path pattern for static assets to the Amazon S3 origin with the minimum, maximum, and default TTL set to 0. Route the API path pattern to the ALB origin with caching enabled, and deploy Amazon ElastiCache for Redis behind the ECS cluster to cache tracking queries.
- CConfigure Amazon Route 53 with a Latency Routing policy to distribute static asset requests directly to S3 buckets in multiple AWS Regions. For dynamic tracking queries, configure Amazon DynamoDB Accelerator (DAX) to cache responses directly at the ALB network layer.
- DConfigure Amazon CloudFront to distribute the static assets from the S3 origin. For dynamic tracking queries, route the traffic from the ALB through a NAT Gateway in the public subnet, and enable VPC flow log caching to intercept and cache the API responses at the network boundary.
Answer
Configure an Amazon CloudFront distribution with two cache behaviors: one routing static assets to the S3 origin with a caching-optimized policy, and another routing API requests to the ALB with caching enabled for a short duration using query string parameters.
The correct architecture uses Amazon CloudFront to optimize content delivery for both static and dynamic contents. By defining two cache behaviors, the solutions architect can apply a long, caching-optimized TTL for static assets stored in S3, and a short TTL (e.g., a few seconds) for the dynamic API requests directed to the ALB. Including the tracking package ID query parameter in the cache key ensures that requests for the same package are served from the cache, while requests for different packages generate distinct cache entries, reducing load on ECS.
Step-by-Step Solution
Key Concept
Multi-tier caching using Amazon CloudFront cache behaviors for S3 and ALB origins to optimize performance and reduce backend load.
Estimated Time:2m 0s