0
0
DynamoDBquery~30 mins

Identifying access patterns first in DynamoDB - Mini Project: Build & Apply

Choose your learning style9 modes available
Identifying Access Patterns First
📖 Scenario: You are designing a DynamoDB table for a simple online bookstore. You want to store book information and be able to quickly find books by their ISBN or by the author's name.
🎯 Goal: Create a DynamoDB table structure that supports fast lookups by ISBN and by author name. You will define the main table and a secondary index to support these access patterns.
📋 What You'll Learn
Create a DynamoDB table named Books with ISBN as the partition key.
Add a Global Secondary Index (GSI) named AuthorIndex with Author as the partition key.
Include attributes Title and Author in the table items.
💡 Why This Matters
🌍 Real World
Designing DynamoDB tables by identifying access patterns first helps build fast and scalable applications like online bookstores, social media apps, or inventory systems.
💼 Career
Understanding how to model DynamoDB tables and indexes based on access patterns is a key skill for cloud developers, backend engineers, and database architects working with AWS.
Progress0 / 4 steps
1
Create the DynamoDB table structure
Create a DynamoDB table named Books with ISBN as the partition key. Define the attributes ISBN, Title, and Author in the item structure.
DynamoDB
Need a hint?

Remember to set ISBN as the partition key in KeySchema and define it in AttributeDefinitions.

2
Add a Global Secondary Index for author lookups
Add a Global Secondary Index named AuthorIndex to the Books table. Use Author as the partition key for this index.
DynamoDB
Need a hint?

Use GlobalSecondaryIndexes with IndexName set to AuthorIndex and Author as the partition key.

3
Add sample book items
Create a list named book_items with two dictionaries representing books. Each dictionary should have keys ISBN, Title, and Author with these exact values: first book with ISBN 978-0132350884, Title Clean Code, Author Robert C. Martin; second book with ISBN 978-0201616224, Title The Pragmatic Programmer, Author Andrew Hunt.
DynamoDB
Need a hint?

Make sure the list is named book_items and contains exactly two dictionaries with the specified keys and values.

4
Define the final table creation parameters
Add the Item key to the book_items dictionaries to prepare them for insertion. Then, create a list named put_requests where each element is a dictionary with the key PutRequest and the value is a dictionary with the key Item set to the book item. This structure is used for batch writing items to DynamoDB.
DynamoDB
Need a hint?

Use a list comprehension to create put_requests with each element as a dictionary containing PutRequest and Item.