Question #1112
A developer created several AWS Lambda functions that interact with an Amazon DynamoDB table. The developer configured all the Lambda functions to send logs and metrics to Amazon CloudWatch. The developer receives reports that one of the Lambda functions experiences high latency when writing data to the DynamoDB table. The developer needs to measure the latency between the problematic Lambda function and the DynamoDB table. Which solution will meet this requirement?
Enable AWS X-Ray on the Lambda function. In the generated trace map, select the line between Lambda and DynamoDB.
Query the Lambda function\u2019s log file in Amazon CloudWatch Logs Insights. Return the average of the auto-discovered @duration field.
Enable CloudWatch Lambda Insights on the function. View the latency graph that CloudWatch Lambda Insights provides.
Enable AWS X-Ray on the Lambda function. Select DynamoDB in the latency graph to view the latency histogram.
Explanation
Answer D is correct because AWS X-Ray provides detailed tracing of AWS SDK calls, including DynamoDB operations. Enabling X-Ray on the Lambda function captures the latency of each DynamoDB request, and the X-Ray latency histogram allows the developer to analyze the distribution of these latencies.
Option A is incorrect because the trace map's line between Lambda and DynamoDB only shows aggregated latency data, not detailed histograms. Option B is incorrect because the @duration field in CloudWatch Logs measures the Lambda function's total execution time, not the specific DynamoDB call latency. Option C is incorrect because CloudWatch Lambda Insights focuses on Lambda's internal metrics (e.g., memory, CPU) and does not break down latency for downstream services like DynamoDB.
Key Points:
- X-Ray traces AWS SDK calls (e.g., DynamoDB) and provides service-specific latency metrics.
- CloudWatch Logs and Lambda Insights lack granularity for external service latency analysis.
Answer
The correct answer is: D