SAP-C02 · Question #821
SAP-C02 Question #821: Real Exam Question with Answer & Explanation
The correct answer is B: Create a CloudFront function to sort incoming request query parameters alphabetically and. Using a CloudFront function to sort the query parameters alphabetically and convert them to lowercase ensures consistent cache behavior. CloudFront functions are lightweight and ideal for this use case as they can manipulate request headers and query parameters before forwarding
Question
A company hosts an application on AWS. The application uses AWS Lambda functions that are invoked by an Amazon API Gateway API. The company has an Amazon CloudFront distribution that uses the API Gateway API as its origin. The CloudFront distribution serves web requests to customers worldwide. During testing, users experienced slow responses from the application APIs. The company discovered that requests from different AWS Regions contained inconsistent query parameters with mixed-case letters, which caused increased cache misses and more requests to reach the Lambda functions The company wants to ensure that the API consistently provides responses with minimal latency. Which solution will meet these requirements?
Options
- ACreate a new Lambda function to sort incoming request query parameters alphabetically and
- BCreate a CloudFront function to sort incoming request query parameters alphabetically and
- CConfigure the API Gateway API to use mapping templates to sort incoming request query
- DConfigure the API Gateway API to use a Lambda authorizer to sort incoming request query
Explanation
Using a CloudFront function to sort the query parameters alphabetically and convert them to lowercase ensures consistent cache behavior. CloudFront functions are lightweight and ideal for this use case as they can manipulate request headers and query parameters before forwarding the request to the origin. By invoking the function on the viewer request, the query parameters are normalized before CloudFront checks the cache, improving cache hit rates and reducing Lambda function invocations.
Community Discussion
No community discussion yet for this question.