Bird
Raised Fist0
DynamoDBquery~20 mins

DynamoDB Streams concept - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
DynamoDB Streams Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What does DynamoDB Streams capture?
DynamoDB Streams records changes in a DynamoDB table. What kind of changes does it capture?
AAll item-level modifications including inserts, updates, and deletes
BOnly deleted items from the table
COnly new items added to the table
DOnly changes to table indexes
Attempts:
2 left
💡 Hint
Think about what you want to track if you want a full history of changes.
❓ query_result
intermediate
1:30remaining
What is the output of this DynamoDB Stream record?
Given a DynamoDB Stream record for an update event, what does the 'NewImage' attribute contain?
DynamoDB
StreamRecord: {
  "eventName": "MODIFY",
  "dynamodb": {
    "NewImage": {"Id": {"S": "101"}, "Status": {"S": "Shipped"}},
    "OldImage": {"Id": {"S": "101"}, "Status": {"S": "Pending"}}
  }
}
AThe item data after the update
BThe item data before the update
COnly the changed attributes
DThe entire table data
Attempts:
2 left
💡 Hint
NewImage means the new state of the item after the change.
📝 Syntax
advanced
2:00remaining
Which option correctly enables DynamoDB Streams on a table with NEW_AND_OLD_IMAGES?
You want to enable DynamoDB Streams on a table to capture both new and old images of items. Which AWS CLI command is correct?
DynamoDB
aws dynamodb update-table --table-name Orders --stream-specification StreamEnabled=true,StreamViewType=NEW_AND_OLD_IMAGES
Aaws dynamodb update-table --table-name Orders --stream-specification StreamEnabled=true;StreamViewType=NEW_AND_OLD_IMAGES
Baws dynamodb update-table --table-name Orders --stream-specification StreamEnabled=true StreamViewType=NEW_AND_OLD_IMAGES
Caws dynamodb update-table --table-name Orders --stream-specification StreamEnabled: true, StreamViewType: NEW_AND_OLD_IMAGES
Daws dynamodb update-table --table-name Orders --stream-specification StreamEnabled=true,StreamViewType=NEW_AND_OLD_IMAGES
Attempts:
2 left
💡 Hint
Check the correct syntax for comma-separated key-value pairs in AWS CLI.
❓ optimization
advanced
1:30remaining
How to minimize costs when using DynamoDB Streams?
You want to reduce costs while using DynamoDB Streams for a high-traffic table. Which approach helps minimize costs?
ADisable Streams and poll the table directly for changes
BEnable Streams with NEW_AND_OLD_IMAGES to capture full item data
CEnable Streams with KEYS_ONLY view type to reduce data volume
DUse Streams with NEW_IMAGE and process all attributes
Attempts:
2 left
💡 Hint
Less data in streams means less processing and storage cost.
🔧 Debug
expert
2:30remaining
Why does this Lambda function triggered by DynamoDB Streams fail with a TypeError?
A Lambda function processes DynamoDB Stream events. It tries to access event.Records[0].dynamodb.NewImage.Name.S but fails with TypeError: Cannot read property 'S' of undefined. What is the likely cause?
DynamoDB
exports.handler = async (event) => {
  const name = event.Records[0].dynamodb.NewImage.Name.S;
  console.log(name);
};
AThe event.Records array is empty
BThe 'Name' attribute does not exist in NewImage for this event
CThe Lambda function lacks permissions to read the stream
DThe stream is disabled on the DynamoDB table
Attempts:
2 left
💡 Hint
Check if the attribute you access is always present in the stream record.

Practice

(1/5)
1. What is the primary purpose of DynamoDB Streams?
easy
A. To back up the entire DynamoDB table automatically every hour
B. To capture and record changes made to items in a DynamoDB table in real time
C. To increase the read capacity of a DynamoDB table
D. To encrypt data stored in DynamoDB tables

Solution

  1. Step 1: Understand DynamoDB Streams functionality

    DynamoDB Streams capture data changes such as inserts, updates, and deletes on a table.
  2. Step 2: Compare options with Streams purpose

    Only To capture and record changes made to items in a DynamoDB table in real time describes capturing changes in real time, which is the core function of Streams.
  3. Final Answer:

    To capture and record changes made to items in a DynamoDB table in real time -> Option B
  4. Quick Check:

    DynamoDB Streams = capture changes [OK]
Hint: Streams track table changes live, not backups or capacity [OK]
Common Mistakes:
  • Confusing Streams with backups
  • Thinking Streams increase capacity
  • Assuming Streams encrypt data
2. Which of the following is the correct way to enable DynamoDB Streams on a table?
easy
A. Enable Auto Scaling on the table
B. Add a Global Secondary Index with StreamEnabled = true
C. Create a Lambda function and attach it to the table without enabling Streams
D. Set the StreamSpecification with StreamEnabled = true and choose a StreamViewType

Solution

  1. Step 1: Recall how to enable Streams

    Streams are enabled by setting StreamSpecification with StreamEnabled true and selecting a StreamViewType.
  2. Step 2: Evaluate options

    Set the StreamSpecification with StreamEnabled = true and choose a StreamViewType correctly describes enabling Streams. Other options relate to indexes, Lambda, or scaling, which do not enable Streams.
  3. Final Answer:

    Set the StreamSpecification with StreamEnabled = true and choose a StreamViewType -> Option D
  4. Quick Check:

    Enable Streams = StreamSpecification true + StreamViewType [OK]
Hint: Enable Streams by setting StreamSpecification true with view type [OK]
Common Mistakes:
  • Confusing Streams with indexes
  • Assuming Lambda enables Streams automatically
  • Thinking Auto Scaling enables Streams
3. Given a DynamoDB Stream with StreamViewType set to NEW_AND_OLD_IMAGES, what data will each stream record contain?
medium
A. Only the new image of the item after the change
B. Only the old image of the item before the change
C. Both the new and old images of the item
D. Only the keys of the changed item

Solution

  1. Step 1: Understand StreamViewType NEW_AND_OLD_IMAGES

    This view type captures both the item image before and after the change.
  2. Step 2: Match options to the view type

    Both the new and old images of the item correctly states both new and old images are included. Other options only mention one or keys.
  3. Final Answer:

    Both the new and old images of the item -> Option C
  4. Quick Check:

    NEW_AND_OLD_IMAGES = new + old images [OK]
Hint: NEW_AND_OLD_IMAGES means both before and after data included [OK]
Common Mistakes:
  • Thinking only new or only old image is included
  • Confusing keys-only view with full images
  • Ignoring the StreamViewType setting
4. You have enabled DynamoDB Streams but your Lambda function is not receiving any events despite recent writes to the table. What is a possible reason?
medium
A. The Lambda function is not properly configured as an event source for the stream
B. The table has no write activity, so no stream records are generated
C. All of the above
D. The StreamViewType was set to KEYS_ONLY, but your Lambda expects full images

Solution

  1. Step 1: Analyze the scenario

    Streams enabled with recent writes means records are generated, so issue is likely with Lambda setup to consume stream events.
  2. Step 2: Evaluate options

    The Lambda not being configured as an event source for the stream explains no events. All of the above doesn't apply since writes occurred. No write activity contradicted by scenario. StreamViewType affects record content, not event delivery to Lambda.
  3. Final Answer:

    The Lambda function is not properly configured as an event source for the stream -> Option A
  4. Quick Check:

    No events despite writes = Lambda event source not mapped [OK]
Hint: Lambda must be mapped as event source to DynamoDB Stream [OK]
Common Mistakes:
  • Ignoring that no writes means no stream records
  • Forgetting to attach Lambda as event source
  • Assuming KEYS_ONLY always sends full data
5. You want to build a system that reacts only when an item's attribute status changes in your DynamoDB table. Which StreamViewType should you choose to efficiently detect this change?
hard
A. NEW_AND_OLD_IMAGES
B. OLD_IMAGE
C. NEW_IMAGE
D. KEYS_ONLY

Solution

  1. Step 1: Identify data needed to detect attribute changes

    To know if 'status' changed, you need both old and new values to compare.
  2. Step 2: Match StreamViewType to requirement

    Only NEW_AND_OLD_IMAGES provides both before and after images for comparison.
  3. Final Answer:

    NEW_AND_OLD_IMAGES -> Option A
  4. Quick Check:

    Detect attribute change = need old + new images [OK]
Hint: Compare old and new images to detect attribute changes [OK]
Common Mistakes:
  • Choosing only NEW_IMAGE or OLD_IMAGE which lacks comparison data
  • Assuming KEYS_ONLY includes attribute data
  • Not realizing both images are needed to detect changes
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard