Question #967
A developer deploys a serverless application on AWS using Amazon API Gateway, AWS Lambda, and Amazon Route 53. During performance testing, the developer observes latency spikes but cannot trace the source across services.
To diagnose the issue, the developer needs to aggregate and analyze logs from all components of the application.
What should the developer do to achieve this with the LEAST operational overhead?
Enable AWS X-Ray tracing for API Gateway and Lambda. Configure X-Ray to send traces to Amazon CloudWatch Logs. Use CloudWatch Logs Insights to query traces and identify latency issues.
Set up Route 53 latency-based routing policies. Enable AWS CloudTrail to log API activity for all services. Stream CloudTrail logs to an Amazon S3 bucket and analyze them using Amazon Athena.
Configure API Gateway and Lambda to stream logs to an Amazon Kinesis Data Firehose delivery stream. Use Kinesis Data Firehose to batch the logs into an Amazon S3 bucket. Analyze the logs using Amazon OpenSearch Service.
Enable Amazon CloudWatch Logs for API Gateway access logging and Lambda execution logs. Use CloudWatch Logs Insights to query and correlate logs across both services in real time.
Explanation
Option D is correct because:
1. Least Operational Overhead: CloudWatch Logs is natively integrated with API Gateway and Lambda, requiring minimal setup to enable logging.
2. Real-Time Analysis: CloudWatch Logs Insights allows querying and correlating logs across both services in real time, helping identify latency sources without additional infrastructure.
3. Coverage: API Gateway access logs and Lambda execution logs capture detailed performance data, while Route 53's role in latency is minimal here.
Other options are incorrect because:
- A: X-Ray does not cover Route 53, and sending traces to CloudWatch Logs adds unnecessary steps.
- B: CloudTrail focuses on API activity auditing, not performance metrics, and Route 53 latency-based routing doesn't diagnose existing spikes.
- C: Kinesis Data Firehose and OpenSearch introduce complexity and operational overhead compared to CloudWatch's native integration.
Key Points: Use CloudWatch Logs for serverless logging due to native integration and low overhead; CloudWatch Logs Insights enables cross-service log analysis.
Answer
The correct answer is: D