QA
Intermediate LevelCloud Computing (AWS/GCP/Azure)

How do DynamoDB Streams trigger AWS Lambda functions for real-time Change Data Capture (CDC)?

❓ Interview Prompt: Explain DynamoDB Streams, stream view types (KEYS_ONLY, NEW_IMAGE, OLD_IMAGE, NEW_AND_OLD_IMAGES), and Lambda event source mappings.

DynamoDB Streams captures a time-ordered sequence of item-level modifications (inserts, updates, deletes) in a DynamoDB table in real time.

Stream View Types:

•
'KEYS_ONLY': Logs only the partition/sort keys of modified items.
•
'NEW_IMAGE': Logs the entire item after modification.
•
'OLD_IMAGE': Logs the entire item before modification.
•
'NEW_AND_OLD_IMAGES': Logs both before and after states.

Real-Time CDC Use Cases:

Triggering Lambda functions to update OpenSearch search indexes, send notification emails, or replicate changes to external data lakes.

Code Implementation Example

typescript
import { DynamoDBStreamHandler } from 'aws-lambda';

// Lambda handler processing CDC records from DynamoDB Stream
export const handler: DynamoDBStreamHandler = async (event) => {
  for (const record of event.Records) {
    if (record.eventName === 'INSERT') {
      const newOrder = record.dynamodb?.NewImage;
      console.log('New Order Inserted:', newOrder?.OrderId?.S);
      // Synchronize to OpenSearch / Cache...
    }
  }
};
💡Lambda function handling Change Data Capture (CDC) events from DynamoDB Stream.
🎯 Interview Key Takeaway

DynamoDB Streams logs item modifications in real time, triggering Lambda functions for event-driven CDC architectures.

#DynamoDB Streams#Lambda#CDC#Event-Driven#Intermediate
Back to all Cloud Computing (AWS/GCP/Azure) Questions→

More Cloud Computing (AWS/GCP/Azure) Interview Questions

Beginner LevelCloud Computing (AWS/GCP/Azure)

How does Serverless Architecture (AWS Lambda / GCP Cloud Run) handle Auto-Scaling and Cold Starts?

Beginner LevelCloud Computing (AWS/GCP/Azure)

What is the difference between IaaS, PaaS, and SaaS cloud service models?

Beginner LevelCloud Computing (AWS/GCP/Azure)

What is AWS EC2 and what are On-Demand, Reserved, and Spot Instance pricing models?