How to notify failed DynamoDB sales above a price threshold with least effort?
Short answer
A Create an event source mapping between DynamoDB Streams and an AWS Lambda function. Use Lambda event filtering to trigger the Lambda function only if sales fail when the price is above the specified threshold. Configure the Lambda function to publish the data to an Amazon Simple Notification Service (Amazon SNS) topic.
Question
Key Takeaways
The question tests whether candidates know that Lambda event filtering can evaluate DynamoDB Stream record payloads (including numeric comparisons) so the function is invoked only when conditions match, reducing development effort.
Use DynamoDB Streams with an AWS Lambda event source mapping and Lambda event filtering to trigger notifications only for failed high-value sales, minimizing code and invocation overhead.
Common mistake: Many candidates pick option C, assuming DynamoDB Streams can be wired directly to an SNS topic with an SNS subscription filter policy; in reality, DynamoDB Streams only support Lambda (and a few other services) as event source destinations, not SNS directly.
Expert Analysis
The requirement is to notify only when TransactionStatus is failed AND Price exceeds a threshold, with the LEAST development effort. The optimal pattern is:
- Enable DynamoDB Streams (already done).
- Create an event source mapping from the stream to an AWS Lambda function.
- Use Lambda event filtering to restrict invocations to records where
dynamodb.NewImage.TransactionStatus.S = "failed"anddynamodb.NewImage.Price.Nsatisfies a numeric condition such as["numeric": [">", threshold]]. - Inside the tiny Lambda handler, publish the filtered payload to an Amazon SNS topic.
Why the other options are wrong:
- Option B also uses Lambda + SNS, but performs the filtering inside the handler code. This works, but it requires writing, testing, and maintaining conditional logic in the function, so it is more development effort than using native event filtering.
- Option C claims you can map DynamoDB Streams directly to an SNS topic and rely on SNS filter policies. DynamoDB Streams does not support SNS as a direct event source destination; it supports Lambda, Kinesis Data Streams, and a few other targets. Therefore this design is not feasible.
- Option D suggests using a CloudWatch alarm on DynamoDB Streams data. CloudWatch alarms operate on metrics, not on individual stream records or attribute values, so they cannot evaluate per-record conditions like "TransactionStatus = failed and Price > X". This option is architecturally incorrect.
Official Reference
- https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventfiltering.html#filtering-ddb
- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Streams.html
- https://docs.aws.amazon.com/sns/latest/dg/sns-subscription-filter-policies.html
These links open the official vendor documentation in a new tab.
Exam Strategy
When a question emphasizes 'LEAST development effort' and involves per-record attribute conditions on a stream, immediately look for the answer that uses native event filtering at the event source mapping rather than in-function logic. Also eliminate options that wire DynamoDB Streams to unsupported targets like SNS directly.
Community Votes
77% of anonymous learners picked answer A. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 7 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 7
-
Alagong 👍 4 Answered ADynamoDB Streams cannot be directly mapped to SNS. This option is not feasible as described. So C is wrong.
-
Anandesh 👍 3 Answered Cdynamodb can be mapped as an event source to SNS. While creating the table, we can turn the stream on. We can push events to SNS topic and apply filter policy
-
Anandesh 👍 3 Answered ACorrection, answer should be A https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventfiltering.html#filtering-ddb
-
tomchandler077 👍 1A By using event filtering, the Lambda function will only be triggered if the conditions (TransactionStatus is 'failed' and Price is above the specified threshold) are met. This reduces unnecessary executions and simplifies the logic within the function.
-
albert_kuo 👍 1 Answered ALambda event filtering { "eventName": ["MODIFY"], "dynamodb.NewImage.TransactionStatus.S": ["failed"], "dynamodb.NewImage.Price.N": [{"numeric": [">", 100]}] }
Show 2 more comments
-
siheom 👍 2 Answered Adefinitely A
-
Saudis 👍 1why not D ??
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All DVA-C02 Questions
Access 100 questions with complete answers and detailed explanations.
View Full DVA-C02 Practice Test →