A DynamoDB table publishes change events to a DynamoDB stream. A Lambda function processes those stream events. Sometimes incoming orders have an order quantity of 0. You need to build a dashboard that shows how many unique customers are affected by this problem each day. What should you implement?
Choose an answer
Tap an option to check your answer.
Correct answer: Give the Lambda execution role permission to publish logs to CloudWatch Logs. Create a CloudWatch Logs Insights query that counts unique customers for records with order quantity = 0, grouped by 1-day intervals, and add that query to a CloudWatch dashboard..
Why this is the answer
The correct approach leverages CloudWatch Logs and CloudWatch Logs Insights. The Lambda function, processing DynamoDB stream events, should log details about orders with a quantity of 0, including customer IDs. By granting the Lambda execution role permission to publish logs to CloudWatch Logs, these critical data points become available for analysis. CloudWatch Logs Insights can then be used to query these logs, specifically counting unique customer IDs where the order quantity is 0, grouped by daily intervals. This query can be directly added to a CloudWatch dashboard for continuous monitoring. Incorrect options: Using Amazon Athena to query CloudTrail API logs is unsuitable because CloudTrail logs API calls, not application-specific order data from a DynamoDB stream. Sending events to EventBridge and creating a rule for aggregation is not the most direct or efficient way to count unique customers from a stream processing Lambda. EventBridge is better suited for routing events, not complex aggregations directly. Enabling custom CloudWatch metrics for the DynamoDB stream wouldn't directly count unique customers with specific order quantities from within the stream data itself. Metrics are typically for aggregated data points, not detailed content analysis.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed