Which reason best explains why DynamoDB works well with AWS Lambda?
Think about how Lambda can react to changes in DynamoDB data automatically.
DynamoDB Streams can trigger Lambda functions automatically when data changes, making it easy to build event-driven applications.
What is a key benefit of using Lambda with DynamoDB for backend logic?
Consider how Lambda helps run code without worrying about servers.
Lambda is serverless, so it runs your code in response to DynamoDB events without you managing any servers.
Given a DynamoDB table with an item inserted, what does the Lambda event contain?
Event example: { "Records": [ { "eventName": "INSERT", "dynamodb": { "NewImage": { "id": { "S": "123" }, "name": { "S": "Alice" } } } } ] }Think about what data DynamoDB Streams send on an insert.
On an insert, DynamoDB Streams send the new item data in NewImage, which Lambda receives in the event.
Which approach best optimizes Lambda function performance when processing DynamoDB Streams?
Think about reducing the number of Lambda invocations for efficiency.
Batching multiple stream records in one Lambda invocation reduces cold starts and overhead, improving performance.
Given this Lambda code snippet processing DynamoDB Stream events, why does it fail?
exports.handler = async (event) => {
const record = event.Records[0];
const id = record.dynamodb.NewImage.id;
console.log('ID:', id);
};Remember how DynamoDB represents attribute values in streams.
DynamoDB Stream records represent attribute values as objects with type keys like S for string, so you must use id.S to get the actual value.