0
0
DynamoDBquery~30 mins

Index capacity and cost in DynamoDB - Mini Project: Build & Apply

Choose your learning style9 modes available
Index Capacity and Cost in DynamoDB
📖 Scenario: You are managing a DynamoDB table for an online bookstore. You want to understand how adding a Global Secondary Index (GSI) affects the table's capacity and cost.
🎯 Goal: Build a DynamoDB table with a primary key and a Global Secondary Index. Configure the read and write capacity units for both the table and the index to see how capacity is allocated.
📋 What You'll Learn
Create a DynamoDB table named Books with a primary key BookID (string).
Add a Global Secondary Index named AuthorIndex with Author as the partition key (string).
Set the table's read capacity units to 5 and write capacity units to 5.
Set the GSI's read capacity units to 3 and write capacity units to 2.
💡 Why This Matters
🌍 Real World
Managing DynamoDB tables with indexes is common in real-world applications to optimize query performance and control costs.
💼 Career
Understanding how to configure capacity units for tables and indexes is essential for database administrators and backend developers working with AWS DynamoDB.
Progress0 / 4 steps
1
Create the DynamoDB table with primary key
Create a DynamoDB table named Books with a primary key called BookID of type string. Set the provisioned throughput with ReadCapacityUnits as 5 and WriteCapacityUnits as 5.
DynamoDB
Need a hint?

Use AWS::DynamoDB::Table resource with AttributeDefinitions, KeySchema, and ProvisionedThroughput.

2
Add Global Secondary Index configuration
Add a Global Secondary Index named AuthorIndex to the Books table. Use Author as the partition key of type string. Do not set capacity units yet.
DynamoDB
Need a hint?

Add GlobalSecondaryIndexes with IndexName, KeySchema, and Projection.

3
Set capacity units for the Global Secondary Index
Set the ReadCapacityUnits to 3 and WriteCapacityUnits to 2 for the AuthorIndex Global Secondary Index in the Books table.
DynamoDB
Need a hint?

Inside the AuthorIndex, add ProvisionedThroughput with the specified capacity units.

4
Complete the DynamoDB table configuration
Ensure the full DynamoDB table resource named BooksTable includes the primary key, provisioned throughput, and the Global Secondary Index AuthorIndex with its capacity units.
DynamoDB
Need a hint?

Review the entire table resource to confirm all parts are included correctly.