Recall & Review
beginner
What does the PutItem operation do in DynamoDB?
PutItem adds a new item or replaces an old item with a new one in a DynamoDB table.
Click to reveal answer
beginner
Which key attribute must you always include when using PutItem?
You must include the primary key attribute(s) defined for the table, such as the partition key and optionally the sort key.
Click to reveal answer
intermediate
What happens if you use PutItem with an item that has the same primary key as an existing item?
The existing item is completely replaced by the new item you provide.
Click to reveal answer
intermediate
How can you prevent overwriting an existing item when using PutItem?
Use a condition expression to check that the item does not already exist before inserting.
Click to reveal answer
beginner
Give an example of a simple PutItem request in DynamoDB.
Example: {"TableName": "Users", "Item": {"UserId": {"S": "123"}, "Name": {"S": "Alice"}}}
Click to reveal answer
What does PutItem do if the item key already exists in the table?
✗ Incorrect
PutItem replaces the entire existing item with the new item if the primary key matches.
Which attribute is mandatory in the Item you provide to PutItem?
✗ Incorrect
The primary key attribute(s) must be included to uniquely identify the item.
How can you avoid overwriting an existing item when using PutItem?
✗ Incorrect
A condition expression can prevent PutItem from overwriting if the item already exists.
What is the minimum required parameter for a PutItem request?
✗ Incorrect
You must specify the table name and the item to insert.
If you want to add a new user with ID '101' and name 'Bob', which is a valid PutItem Item format?
✗ Incorrect
DynamoDB expects attribute values with types, e.g., {"S": "string"} for strings.
Explain how PutItem works in DynamoDB and what happens if the item key already exists.
Think about inserting and overwriting items.
You got /3 concepts.
Describe how to prevent overwriting an existing item when using PutItem.
Conditions can control when PutItem succeeds.
You got /3 concepts.