Bird
0
0

In a Lambda function triggered by DynamoDB Streams, how can you ensure that only records with the event type 'MODIFY' are processed, ignoring 'INSERT' and 'REMOVE' events?

hard📝 Application Q8 of 15
AWS - Serverless Architecture
In a Lambda function triggered by DynamoDB Streams, how can you ensure that only records with the event type 'MODIFY' are processed, ignoring 'INSERT' and 'REMOVE' events?
AUse a DynamoDB Stream filter to exclude 'INSERT' and 'REMOVE' events before Lambda invocation
BProcess all records without checking event type, then filter in downstream logic
CCheck if <code>record['eventName'] == 'MODIFY'</code> before processing each record
DConfigure the Lambda trigger to only invoke on 'MODIFY' events in the AWS Console
Step-by-Step Solution
Solution:
  1. Step 1: Understand event filtering

    DynamoDB Streams send all events (INSERT, MODIFY, REMOVE) to Lambda by default.
  2. Step 2: Implement event type check in Lambda

    Within the Lambda handler, check record['eventName'] and process only if it equals 'MODIFY'.
  3. Step 3: Evaluate other options

    Process all records without checking event type, then filter in downstream logic processes all events unnecessarily; Use a DynamoDB Stream filter to exclude 'INSERT' and 'REMOVE' events before Lambda invocation is not supported natively; Configure the Lambda trigger to only invoke on 'MODIFY' events in the AWS Console is not configurable in AWS Console.
  4. Final Answer:

    Check if record['eventName'] == 'MODIFY' before processing each record -> Option C
  5. Quick Check:

    Event filtering must be done in code [OK]
Quick Trick: Filter events inside Lambda by checking eventName [OK]
Common Mistakes:
  • Assuming AWS Console can filter stream events by type
  • Processing all events without filtering
  • Expecting DynamoDB Streams to send only MODIFY events

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes