AWS Certified Developer – Associate — Question 215
A developer has created a REST API using Amazon API Gateway. The developer wants to log who and how each caller accesses the API. The developer also wants to control how long the logs are kept.
What should the developer do to meet these requirements?
Answer options
- A. Enable API Gateway execution logging. Delete old logs using API Gateway retention settings.
- B. Enable API Gateway access logs. Use Amazon CloudWatch retention settings to delete old logs.
- C. Enable detailed Amazon CloudWatch metrics. Delete old logs with a recurring AWS Lambda function.
- D. Create and use API Gateway usage plans. Delete old logs with a recurring AWS Lambda function.
Correct answer: B
Explanation
The correct answer is B because enabling API Gateway access logs allows for capturing detailed information about API calls, and Amazon CloudWatch retention settings effectively manage the lifespan of these logs. Option A incorrectly suggests execution logging instead of access logging, while options C and D do not specifically address the requirement for logging access details and log retention management.