Bird
0
0

In a serverless architecture where DynamoDB updates trigger Lambda functions that write to another DynamoDB table, what is the best approach to maintain data consistency?

hard🚀 Application Q8 of 15
DynamoDB - with Serverless
In a serverless architecture where DynamoDB updates trigger Lambda functions that write to another DynamoDB table, what is the best approach to maintain data consistency?
AWrite to both tables simultaneously in the client application
BInvoke Lambda functions directly from the client after updating the first table
CUse scheduled Lambda functions to periodically sync both tables
DUse DynamoDB Streams with Lambda and implement idempotent writes in the Lambda function
Step-by-Step Solution
Solution:
  1. Step 1: Use DynamoDB Streams to trigger Lambda

    This ensures Lambda reacts to actual data changes reliably.
  2. Step 2: Implement idempotency in Lambda

    Idempotent writes prevent duplicate or inconsistent data during retries.
  3. Step 3: Avoid client-side direct invocation or scheduled sync

    These approaches risk inconsistency and latency.
  4. Final Answer:

    Use DynamoDB Streams with Lambda and implement idempotent writes in the Lambda function -> Option D
  5. Quick Check:

    Streams + idempotent Lambda ensures consistency [OK]
Quick Trick: Use Streams and idempotent Lambda writes [OK]
Common Mistakes:
MISTAKES
  • Triggering Lambda from client instead of Streams
  • Relying on scheduled syncs causing delays
  • Writing to both tables from client risking partial failure

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More DynamoDB Quizzes