Question

Difficulty: HardHigh-Performing Content Delivery and Caching Solutions

A gaming company has a mobile game played by users worldwide. The application retrieves game configuration metadata from an API hosted on Amazon API Gateway and backed by AWS Lambda. The metadata is updated once daily. During peak tournament hours, the Lambda functions experience a high volume of requests, causing concurrency throttling and increased latency for global players. A solutions architect needs to design a caching solution to reduce the load on the Lambda functions and minimize response latency for players globally. Which solution will meet these requirements with the lowest latency for global players?

  1. Create a custom Amazon CloudFront distribution with a regional API Gateway stage as the origin. Enable caching on CloudFront using a cache policy with a 24-hour TTL, and update the DNS record for the custom domain to point to the CloudFront distribution.Answer
  2. B
    Create a custom Amazon CloudFront distribution with a regional API Gateway stage as the origin. Configure the cache behavior's Minimum TTL, Default TTL, and Maximum TTL to 0 to ensure players always receive the most up-to-date configuration metadata directly from the origin.
  3. C
    Migrate the metadata storage to an Amazon DynamoDB table using a sequential timestamp as the partition key to optimize query performance, and enable DynamoDB Accelerator (DAX) to cache the queries.
  4. D
    Write an AWS Lambda function that runs continuously in a loop to handle the high volume of incoming player requests, caching the configuration in the Lambda function's memory, and route traffic using a NAT Gateway.

Answer

Create a custom Amazon CloudFront distribution with a regional API Gateway stage as the origin. Enable caching on CloudFront using a cache policy with a 24-hour TTL, and update the DNS record for the custom domain to point to the CloudFront distribution.
The correct solution uses an Amazon CloudFront distribution to cache game configuration metadata at edge locations globally. Because the metadata is updated only once per day, caching the response for 24 hours at the edge ensures that almost all requests are served from the cache, reducing backend Lambda invocations to a minimum and lowering player response times to sub-milliseconds. Directing custom domain traffic to CloudFront preserves the client endpoint configuration.

Step-by-Step Solution

1
Deploy a custom Amazon CloudFront distribution and set the origin to point to a Regional API Gateway stage.
A global content delivery network is placed in front of the API Gateway endpoints.
CloudFront routes traffic through edge locations close to users worldwide, minimizing network latency.
2
Create and associate a Cache Policy with a Minimum, Default, and Maximum TTL of 24 hours (86,400 seconds) on the CloudFront distribution behavior.
Requests for configuration metadata are cached at the edge locations.
This prevents redundant player requests from propagating to the origin API Gateway and Lambda functions, resolving the concurrency throttling issues.
3
Update the Route 53 DNS record for the custom API domain to point to the CloudFront distribution URL.
Traffic from mobile clients is seamlessly routed through CloudFront with no changes required in the mobile application code.
This ensures a transparent deployment with zero downtime.

Key Concept

Edge caching using Amazon CloudFront in front of regional API endpoints protects compute resources and minimizes latency for global clients.
Estimated Time:2m 0s
Rate this question