Question #860
A company operates a serverless application on AWS using Amazon API Gateway and AWS Lambda functions, which interact with Amazon DynamoDB. During peak traffic, users report intermittent latency issues, though all requests succeed. A developer needs to determine the root cause of these latency spikes across the Lambda functions.
Which solution will meet these requirements?
Use Amazon CloudWatch Logs Insights to query all Lambda function log groups. Filter logs by report type and sort results in descending order based on execution duration to identify the slowest executions.
Enable AWS CloudTrail Insights on the account hosting the Lambda functions. After CloudTrail Insights processes the data, analyze the insights dashboard to detect anomalous activity impacting Lambda performance.
Enable AWS X-Ray for all Lambda functions. Create an X-Ray group encompassing all functions and configure an X-Ray insight. After processing, review the insight results to pinpoint latency root causes.
Use AWS Athena to query logs stored in Amazon S3 from CloudWatch Logs. Transform the logs into a structured format and visualize the slowest executions using Amazon QuickSight dashboards.
Explanation
AWS X-Ray (Option C) is the correct choice because it provides detailed tracing capabilities for distributed applications, allowing developers to visualize the entire request flow across API Gateway, Lambda, and DynamoDB. X-Ray Insights automatically detects anomalies and highlights latency spikes, making it easier to identify bottlenecks (e.g., slow DynamoDB queries or Lambda cold starts).
- Option A: CloudWatch Logs Insights can show Lambda execution durations but lacks end-to-end tracing across services, making it harder to isolate latency causes.
- Option B: CloudTrail Insights focuses on API activity auditing, not performance diagnostics.
- Option D: Athena and QuickSight require manual log analysis and lack real-time, service-level tracing.
Key Points: Use AWS X-Ray for tracing and latency analysis in serverless architectures. It captures detailed request data across services and provides automated insights for performance issues.
Answer
The correct answer is: C