You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
DynamoDB provides a rich set of API operations for reading and writing data. This lesson covers the core operations — PutItem, GetItem, UpdateItem, DeleteItem, Query, and Scan — along with conditional expressions, batch operations, and transactions.
Creates a new item or replaces an existing item with the same primary key:
aws dynamodb put-item \
--table-name Users \
--item '{
"UserId": {"S": "user-001"},
"Name": {"S": "Alice"},
"Email": {"S": "alice@example.com"},
"Age": {"N": "30"}
}'
Important: PutItem replaces the entire item. If an item with the same key exists, all attributes are overwritten.
Modifies specific attributes of an existing item (or creates it if it does not exist):
aws dynamodb update-item \
--table-name Users \
--key '{"UserId": {"S": "user-001"}}' \
--update-expression "SET Age = :newAge, UpdatedAt = :ts" \
--expression-attribute-values '{
":newAge": {"N": "31"},
":ts": {"S": "2024-03-04T12:00:00Z"}
}'
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.