AWS Certified Developer – Associate (DVA-C02) — Question 367
A company that has large online business uses an Amazon DynamoDB table to store sales data. The company enabled Amazon DynamoDB Streams on the table. The transaction status of each sale is stored in a TransactionStatus attribute in the table. The value of the TransactionStatus attribute must be either failed, pending, or completed.
The company wants to be notified of failed sales where the Price attribute is above a specific threshold. A developer needs to set up notification for the failed sales.
Which solution will meet these requirements with the LEAST development effort?
Answer 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 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.
- B. Create an event source mapping between DynamoDB Streams and an AWS Lambda function. Configure the Lambda function handler code to publish to an Amazon Simple Notification Service (Amazon SNS) topic if sales fail when price is above the specified threshold.
- C. Create an event source mapping between DynamoDB Streams and an Amazon Simple Notification Service (Amazon SNS) topic. Use event filtering to publish to the SNS topic if sales fail when the price is above the specified threshold.
- D. Create an Amazon CloudWatch alarm to monitor the DynamoDB Streams sales data. Configure the alarm to publish to an Amazon Simple Notification Service (Amazon SNS) topic if sales fail due when price is above the specified threshold.
Correct answer: A
Explanation
Option A is correct because Lambda event filtering allows the Lambda function to only run when the specified criteria are met, minimizing development effort and invocation costs. Option B requires writing and maintaining custom filtering logic within the Lambda code, which increases development overhead. Option C is incorrect because DynamoDB Streams cannot directly target Amazon SNS without Lambda, and Option D is incorrect because CloudWatch alarms cannot inspect individual stream record attributes.