Bird
0
0

You want a Lambda function to process DynamoDB stream events and update a separate 'Analytics' table with counts of new items added. Which approach correctly handles this?

hard🚀 Application Q8 of 15
DynamoDB - with Serverless
You want a Lambda function to process DynamoDB stream events and update a separate 'Analytics' table with counts of new items added. Which approach correctly handles this?
AUpdate the 'Analytics' table only when the Lambda is manually triggered
BScan the entire DynamoDB table inside Lambda and count items each time
CIn the Lambda, iterate over event.Records, check eventName 'INSERT', then increment count in 'Analytics' table
DUse a scheduled Lambda to update counts daily without processing streams
Step-by-Step Solution
Solution:
  1. Step 1: Understand DynamoDB Streams event structure

    Streams send event records with eventName like 'INSERT' for new items.
  2. Step 2: Process only 'INSERT' events to update counts

    Iterate event.Records, detect 'INSERT', then update 'Analytics' table accordingly.
  3. Final Answer:

    In the Lambda, iterate over event.Records, check eventName 'INSERT', then increment count in 'Analytics' table -> Option C
  4. Quick Check:

    Process stream INSERT events to update counts [OK]
Quick Trick: Use event.Records and eventName to detect inserts [OK]
Common Mistakes:
MISTAKES
  • Scanning whole table repeatedly
  • Ignoring stream events
  • Relying on manual or scheduled triggers only

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More DynamoDB Quizzes