AWS Certified Developer – Associate (DVA-C02) — Question 179
A company developed an API application on AWS by using Amazon CloudFront, Amazon API Gateway, and AWS Lambda. The API has a minimum of four requests every second. A developer notices that many API users run the same query by using the POST method. The developer wants to cache the POST request to optimize the API resources.
Which solution will meet these requirements?
Answer options
- A. Configure the CloudFront cache. Update the application to return cached content based upon the default request headers.
- B. Override the cache method in the selected stage of API Gateway. Select the POST method.
- C. Save the latest request response in Lambda /tmp directory. Update the Lambda function to check the /tmp directory.
- D. Save the latest request in AWS Systems Manager Parameter Store. Modify the Lambda function to take the latest request response from Parameter Store.
Correct answer: B
Explanation
Option B is correct because overriding the cache method for the POST method in API Gateway allows for caching responses and effectively managing repeated queries. Option A does not specifically address caching for POST requests, while options C and D involve storing responses but do not leverage API Gateway's caching capabilities, which would be more efficient for this scenario.