AWS Certified Developer – Associate (DVA-C02) — Question 206
A company uses Amazon API Gateway to expose a set of APIs to customers. The APIs have caching enabled in API Gateway. Customers need a way to invalidate the cache for each API when they test the API.
What should a developer do to give customers the ability to invalidate the API cache?
Answer options
- A. Ask the customers to use AWS credentials to call the InvalidateCache API operation.
- B. Attach an InvalidateCache policy to the IAM execution role that the customers use to invoke the API. Ask the customers to send a request that contains the Cache-Control:max-age=0 HTTP header when they make an API call.
- C. Ask the customers to use the AWS SDK API Gateway class to invoke the InvalidateCache API operation.
- D. Attach an InvalidateCache policy to the IAM execution role that the customers use to invoke the API. Ask the customers to add the INVALIDATE_CACHE query string parameter when they make an API call.
Correct answer: B
Explanation
The correct answer is B because it provides a clear method for customers to invalidate the cache by including the appropriate HTTP header. Option A is incorrect as it does not specify how to invalidate the cache. Option C does not address the cache invalidation requirement directly. Option D fails to utilize the correct method for cache invalidation through HTTP headers.