AWS Lambda is a service that runs your code automatically when something happens, without you needing to manage servers.
Click to reveal answer
beginner
What is DynamoDB Streams?
DynamoDB Streams captures changes (like adds, updates, deletes) in a DynamoDB table and lets other services react to those changes.
Click to reveal answer
intermediate
How does Lambda work with DynamoDB Streams?
Lambda listens to the stream of changes from DynamoDB and runs your code automatically for each change, like a helper reacting to updates.
Click to reveal answer
intermediate
Why use Lambda with DynamoDB Streams?
It helps automate tasks like sending notifications or updating other systems whenever your database changes, without manual work.
Click to reveal answer
advanced
What is a best practice when configuring Lambda with DynamoDB Streams?
Set the batch size to control how many records Lambda processes at once and handle errors to avoid losing data.
Click to reveal answer
What triggers an AWS Lambda function when using DynamoDB Streams?
AChanges in the DynamoDB table
BManual button press
CScheduled time only
DUser login event
✗ Incorrect
Lambda is triggered automatically by changes (inserts, updates, deletes) in the DynamoDB table via Streams.
What type of data does DynamoDB Streams provide to Lambda?
AUser credentials
BFull database backup
CA list of changed records
DServer logs
✗ Incorrect
DynamoDB Streams sends a list of records that changed, so Lambda can process each change.
Which Lambda setting controls how many stream records are processed at once?
ATimeout
BBatch size
CMemory size
DRuntime version
✗ Incorrect
Batch size defines how many records Lambda reads from the stream in one go.
What happens if Lambda fails to process a DynamoDB Stream record?
AThe database rolls back changes
BThe record is deleted immediately
CLambda shuts down permanently
DThe record can be retried or sent to a dead-letter queue
✗ Incorrect
Failed records can be retried or sent to a dead-letter queue for later inspection.
Why is using Lambda with DynamoDB Streams considered event-driven architecture?
ABecause Lambda reacts automatically to database events
BBecause it uses scheduled tasks
CBecause it requires manual triggers
DBecause it stores data permanently
✗ Incorrect
Event-driven means actions happen automatically when events (like data changes) occur.
Explain how AWS Lambda and DynamoDB Streams work together to automate tasks.
Think about how a helper reacts when something changes in your database.
You got /4 concepts.
Describe best practices for configuring Lambda functions that process DynamoDB Streams.
Consider how to keep your automation reliable and efficient.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of connecting AWS Lambda to DynamoDB Streams?
easy
A. To manually trigger Lambda functions from the AWS console
B. To automatically run code when data in the DynamoDB table changes
C. To backup DynamoDB data to S3 automatically
D. To increase the read capacity of the DynamoDB table
Solution
Step 1: Understand DynamoDB Streams role
DynamoDB Streams capture data changes in the table as events.
Step 2: Understand Lambda integration
Lambda can be triggered automatically by these stream events to run code.
Final Answer:
To automatically run code when data in the DynamoDB table changes -> Option B
Quick Check:
Lambda triggers on stream events = A [OK]
Hint: Streams trigger Lambda on data changes automatically [OK]
Common Mistakes:
Thinking Lambda triggers manually from console
Confusing streams with backups
Assuming streams increase table capacity
2. Which of the following is the correct way to enable DynamoDB Streams on a table?
easy
A. Create a Lambda function and attach it to the table
B. Enable versioning on the DynamoDB table
C. Set the stream specification to NEW_AND_OLD_IMAGES in the table settings
D. Increase the write capacity units of the table
Solution
Step 1: Identify how to enable streams
DynamoDB Streams are enabled by setting the stream specification on the table.
Step 2: Choose correct stream view type
NEW_AND_OLD_IMAGES captures both before and after images of changes.
Final Answer:
Set the stream specification to NEW_AND_OLD_IMAGES in the table settings -> Option C
Quick Check:
Stream enabled via table settings = B [OK]
Hint: Enable streams in table settings, not in Lambda [OK]
Common Mistakes:
Trying to enable streams by creating Lambda
Confusing versioning with streams
Changing capacity units instead of streams
3. Given this Lambda event handler code snippet triggered by DynamoDB Streams:
def lambda_handler(event, context):
for record in event['Records']:
if record['eventName'] == 'INSERT':
print(record['dynamodb']['NewImage']['id']['S'])
What will this code print when a new item with id '123' is added to the DynamoDB table?
medium
A. '123' printed once for the new item
B. 'id' key printed instead of its value
C. An error because 'NewImage' does not exist
D. Nothing, because eventName is not 'INSERT'
Solution
Step 1: Understand event structure for INSERT
For an INSERT event, 'NewImage' contains the new item data including 'id'.
Step 2: Analyze code behavior
The code prints the string value of 'id' from 'NewImage' when eventName is 'INSERT'.
Final Answer:
'123' printed once for the new item -> Option A
Quick Check:
INSERT event prints new id value = D [OK]
Hint: INSERT events have NewImage with new item data [OK]
Common Mistakes:
Assuming eventName is different
Expecting OldImage on INSERT
Confusing key name with value
4. You deployed a Lambda function triggered by DynamoDB Streams but it never runs. Which of the following is the most likely cause?
medium
A. The DynamoDB table does not have streams enabled
B. The Lambda function code has a syntax error
C. The DynamoDB table has no read capacity units
D. The Lambda function has no execution role
Solution
Step 1: Check stream enablement
Lambda triggers on DynamoDB Streams events, so streams must be enabled on the table.
Step 2: Consider other causes
While code errors or roles cause failures, the function would still be invoked if streams exist.
Final Answer:
The DynamoDB table does not have streams enabled -> Option A
Quick Check:
Streams must be enabled for Lambda trigger = C [OK]
Hint: Check if streams are enabled on the table first [OK]
Common Mistakes:
Assuming code errors prevent invocation
Ignoring missing streams
Confusing read capacity with triggers
5. You want your Lambda function to process only updated attributes from DynamoDB Streams and ignore inserts and deletes. Which stream view type and event filter should you use?
hard
A. Enable NEW_AND_OLD_IMAGES stream view and filter events where eventName is 'INSERT'
B. Enable KEYS_ONLY stream view and filter events where eventName is 'INSERT'
C. Enable OLD_IMAGE stream view and filter events where eventName is 'REMOVE'
D. Enable NEW_IMAGE stream view and filter events where eventName is 'MODIFY'
Solution
Step 1: Choose stream view for updated data
NEW_IMAGE provides the new state after update, suitable for processing changes.
Step 2: Filter events for updates only
Filtering on eventName 'MODIFY' ensures only update events trigger Lambda.
Final Answer:
Enable NEW_IMAGE stream view and filter events where eventName is 'MODIFY' -> Option D
Quick Check:
Updates = NEW_IMAGE + 'MODIFY' filter [OK]
Hint: Use NEW_IMAGE and 'MODIFY' event filter for updates only [OK]
Common Mistakes:
Using KEYS_ONLY which lacks attribute data
Filtering on INSERT or REMOVE instead of MODIFY
Choosing OLD_IMAGE which shows old data only
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.