0
0
DynamoDBquery~20 mins

Why DynamoDB pairs with Lambda - Challenge Your Understanding

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
DynamoDB Lambda Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why is DynamoDB a good match for AWS Lambda?

Which reason best explains why DynamoDB works well with AWS Lambda?

ALambda functions can only read data from DynamoDB but cannot write back to it.
BDynamoDB stores data in files that Lambda reads directly from the file system.
CDynamoDB requires manual polling by Lambda to detect data changes, which is efficient.
DDynamoDB automatically triggers Lambda functions on data changes, enabling event-driven processing.
Attempts:
2 left
💡 Hint

Think about how Lambda can react to changes in DynamoDB data automatically.

🧠 Conceptual
intermediate
2:00remaining
What benefit does Lambda provide when paired with DynamoDB?

What is a key benefit of using Lambda with DynamoDB for backend logic?

ALambda lets you run backend code without managing servers, triggered by DynamoDB events.
BLambda requires you to manage servers to process DynamoDB data.
CLambda only works with relational databases, not DynamoDB.
DLambda stores data permanently, replacing DynamoDB's role.
Attempts:
2 left
💡 Hint

Consider how Lambda helps run code without worrying about servers.

query_result
advanced
2:00remaining
What output does this DynamoDB Stream event Lambda receive?

Given a DynamoDB table with an item inserted, what does the Lambda event contain?

DynamoDB
Event example: { "Records": [ { "eventName": "INSERT", "dynamodb": { "NewImage": { "id": { "S": "123" }, "name": { "S": "Alice" } } } } ] }
AThe event is empty because inserts do not trigger Lambda.
BThe event contains only the old item data before insertion.
CThe event contains the new item data under Records[0].dynamodb.NewImage.
DThe event contains a SQL query string to fetch the new item.
Attempts:
2 left
💡 Hint

Think about what data DynamoDB Streams send on an insert.

optimization
advanced
2:00remaining
How to optimize Lambda processing with DynamoDB Streams?

Which approach best optimizes Lambda function performance when processing DynamoDB Streams?

ADisable DynamoDB Streams to avoid Lambda triggers and improve speed.
BBatch multiple stream records in one Lambda invocation to reduce overhead.
CInvoke a separate Lambda for each individual stream record immediately.
DUse Lambda to poll DynamoDB table every second instead of streams.
Attempts:
2 left
💡 Hint

Think about reducing the number of Lambda invocations for efficiency.

🔧 Debug
expert
3:00remaining
Why does this Lambda fail to process DynamoDB Stream events?

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);
};
ABecause NewImage attributes are objects with type keys, you must access id.S to get the string value.
BBecause event.Records is empty on insert events, so record is undefined.
CBecause Lambda cannot access DynamoDB Stream events without special permissions.
DBecause console.log is not supported in Lambda functions.
Attempts:
2 left
💡 Hint

Remember how DynamoDB represents attribute values in streams.