0
0
AWScloud~30 mins

Tables, items, and attributes in AWS - Mini Project: Build & Apply

Choose your learning style9 modes available
Create and Populate a DynamoDB Table
📖 Scenario: You are setting up a simple database to store information about books in a library. You will create a DynamoDB table, define its key structure, and add some book items with attributes.
🎯 Goal: Build a DynamoDB table named LibraryBooks with a primary key and add three book items with specific attributes.
📋 What You'll Learn
Create a DynamoDB table named LibraryBooks with BookID as the partition key (string type).
Define a variable books containing three book items with attributes: BookID, Title, and Author.
Use a loop to add each book item to the LibraryBooks table.
Add a final configuration to enable point-in-time recovery on the table.
💡 Why This Matters
🌍 Real World
DynamoDB tables are used to store structured data for applications like libraries, e-commerce, and user profiles.
💼 Career
Understanding how to create tables, add items, and configure recovery is essential for cloud engineers and developers working with AWS databases.
Progress0 / 4 steps
1
Create the DynamoDB table definition
Create a variable called table_definition that defines a DynamoDB table named LibraryBooks with a partition key named BookID of type string.
AWS
Need a hint?

Use a dictionary with keys TableName, KeySchema, AttributeDefinitions, and ProvisionedThroughput.

2
Define the book items data
Create a variable called books that is a list of dictionaries. Each dictionary represents a book with keys BookID, Title, and Author. Add these exact books: {'BookID': 'B1', 'Title': '1984', 'Author': 'George Orwell'}, {'BookID': 'B2', 'Title': 'To Kill a Mockingbird', 'Author': 'Harper Lee'}, and {'BookID': 'B3', 'Title': 'The Great Gatsby', 'Author': 'F. Scott Fitzgerald'}.
AWS
Need a hint?

Use a list with three dictionaries exactly matching the book details.

3
Add the book items to the table
Write a for loop using variables book to iterate over the books list and add each book to the LibraryBooks table using a method call table.put_item(Item=book).
AWS
Need a hint?

Use a for loop with variable book and call table.put_item(Item=book) inside the loop.

4
Enable point-in-time recovery on the table
Add a configuration line to enable point-in-time recovery on the LibraryBooks table by calling table.update_point_in_time_recovery(PointInTimeRecoverySpecification={'PointInTimeRecoveryEnabled': True}).
AWS
Need a hint?

Call table.update_point_in_time_recovery with the correct dictionary to enable recovery.