Jeff’s Note #
Unlike generic exam dumps, ADH analyzes this scenario through the lens of a Real-World Lead Developer.
For AWS DVA-C02 candidates, the confusion often lies in when and how to use Lambda event filtering versus transforming data inside the Lambda handler itself. In production, minimizing development time and costs often means offloading simple filtering to event source mechanisms instead of coding complex conditions in Lambda. Let’s drill down.
The Certification Drill (Simulated Question) #
Scenario #
TechNext, a fast-growing e-commerce startup, stores all online order records in an Amazon DynamoDB table named OrdersTable. Each item in the table contains an attribute OrderStatus, which can be one of three string values: "failed", "pending", or "completed". The Price attribute records the total order amount.
TechNext enabled DynamoDB Streams on the table to capture real-time changes. They want to notify their operations team only when orders fail and the order price exceeds $500. A developer is tasked with implementing a notification solution that requires the least amount of development effort.
The Requirement: #
Configure a serverless workflow triggered by changes in the DynamoDB Streams to alert the Ops team via Amazon SNS only on failed orders where Price > 500.
The Options #
-
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 orders fail and the price exceeds 500. Configure the Lambda function to publish the details to an Amazon SNS topic.
-
B) Create an event source mapping between DynamoDB Streams and an AWS Lambda function. Configure the Lambda function code to inspect each record and publish to an SNS topic if order status is “failed” and price is above 500.
-
C) Create an event source mapping between DynamoDB Streams and an Amazon SNS topic. Use event filtering to publish directly to the SNS topic when orders fail and price is over 500.
-
D) Create a CloudWatch alarm to monitor the DynamoDB Streams events for failed orders with price above 500, and configure the alarm to publish notifications to an SNS topic.
Google adsense #
leave a comment:
Correct Answer #
A
Quick Insight: The Developer Efficiency Imperative #
Using Lambda event filtering moves simple attribute-based filtering to the event source mapping configuration, which reduces the amount of custom code needed inside Lambda. This approach minimizes development and maintenance effort while still allowing you to react to complex conditions on DynamoDB Streams events.
Options B and D require more code or indirect monitoring methods, increasing complexity and operational overhead. Option C is invalid because SNS cannot be configured as a DynamoDB Streams event source directly.
Content Locked: The Expert Analysis #
You’ve identified the answer. But do you know the implementation details that separate a Junior from a Senior?
The Expert’s Analysis #
Correct Answer #
Option A
The Winning Logic #
Option A leverages Lambda event filtering on DynamoDB Streams, which allows you to declare attribute-based filters in the event source mapping itself. This filter can inspect the OrderStatus and Price fields on each record and only invoke the Lambda function for relevant changes.
This means:
-
The Lambda code only deals with processing valid, filtered events, reducing complexity.
-
Dev effort is minimized since you do not need to write explicit conditional checks for the attribute values inside the Lambda handler.
-
This results in cleaner, more maintainable code and less telemetry noise.
-
Once triggered, the Lambda simply pushes a message to the SNS topic to notify the operations team about failed, expensive orders.
The Trap (Distractor Analysis): #
-
Why not B?
This approach works but requires more development effort because the Lambda function must inspect every record and decide whether to publish to SNS. This adds complexity and execution costs, as Lambda is invoked for every stream event regardless of status or price. -
Why not C?
SNS cannot serve as a direct event source for DynamoDB Streams. Event source mappings are supported for Lambda, Kinesis, etc., but not SNS. This is a fundamental AWS service limitation. -
Why not D?
CloudWatch Alarms cannot directly monitor DynamoDB Stream data attributes. They monitor metrics or logs. This indirect approach would require additional processing (e.g., custom metric filters), increasing setup complexity and latency.
The Technical Blueprint #
# Example AWS CLI command to set up DynamoDB Streams event source mapping with event filtering on Lambda
aws lambda create-event-source-mapping \
--function-name NotifyFailedOrdersFunction \
--event-source-arn arn:aws:dynamodb:us-east-1:123456789012:table/OrdersTable/stream/2024-01-01T00:00:00.000 \
--batch-size 100 \
--starting-position LATEST \
--filter-criteria '{
"Filters": [
{
"Pattern": "{\"dynamodb\":{\"NewImage\":{\"OrderStatus\":{\"S\":[\"failed\"]},\"Price\":{\"N\":[\">500\"]}}}}"
}
]
}'
The Comparative Analysis (Mandatory for Associate/Pro/Specialty) #
| Option | API Complexity | Performance | Use Case |
|---|---|---|---|
| A | Low - uses event filtering | Efficient - Lambda called selectively | Best for minimal code, real-time filtering |
| B | Medium - custom Lambda logic | Inefficient - Lambda invoked for all events | Suitable if filters cannot be expressed in event source |
| C | Invalid - unsupported event source | N/A | AWS does not support SNS as event source for Streams |
| D | High - indirect monitoring with alarms | Latency due to metric extraction | Complex, more for metrics-based alerts |
Real-World Application (Practitioner Insight) #
Exam Rule #
“For the exam, always pick Lambda event filtering when you need to trigger processing based on specific DynamoDB Streams record attributes.”
Real World #
“In production, sometimes event filtering isn’t enough for complex business logic, and you need full Lambda inspection—but for straightforward attribute checks, event filtering reduces unnecessary Lambda invocations and speeds up debugging.”
(CTA) Stop Guessing, Start Mastering #
Disclaimer
This is a study note based on simulated scenarios for the DVA-C02 exam.