0
0
DynamoDBquery~30 mins

Read and write capacity units in DynamoDB - Mini Project: Build & Apply

Choose your learning style9 modes available
Manage Read and Write Capacity Units in DynamoDB
📖 Scenario: You are managing a DynamoDB table for an online bookstore. To keep the database fast and cost-effective, you need to set the right read and write capacity units.
🎯 Goal: Learn how to create a DynamoDB table with specific read and write capacity units, then update those units as needed.
📋 What You'll Learn
Create a DynamoDB table named Books with a primary key ISBN (string).
Set the initial read capacity units to 5 and write capacity units to 10.
Create a variable called new_read_capacity and set it to 8.
Create a variable called new_write_capacity and set it to 15.
Write the code to update the Books table's provisioned throughput to the new capacity units.
💡 Why This Matters
🌍 Real World
Managing read and write capacity units helps keep DynamoDB tables responsive and cost-effective in real applications like online stores.
💼 Career
Understanding capacity units is important for database administrators and backend developers working with AWS DynamoDB to optimize performance and cost.
Progress0 / 4 steps
1
Create the DynamoDB table with initial capacity units
Create a DynamoDB table named Books with a primary key called ISBN of type string. Set the read capacity units to 5 and write capacity units to 10.
DynamoDB
Need a hint?

Use dynamodb.create_table with ProvisionedThroughput to set capacity units.

2
Set new capacity unit variables
Create two variables: new_read_capacity set to 8 and new_write_capacity set to 15.
DynamoDB
Need a hint?

Just assign the numbers to the variables as shown.

3
Get the existing table resource
Get the DynamoDB table resource for the Books table using dynamodb.Table('Books') and assign it to a variable called table.
DynamoDB
Need a hint?

Use dynamodb.Table('Books') to get the table resource.

4
Update the table's provisioned throughput
Use the update method on the table variable to set the ProvisionedThroughput with ReadCapacityUnits equal to new_read_capacity and WriteCapacityUnits equal to new_write_capacity.
DynamoDB
Need a hint?

Use table.update(ProvisionedThroughput={...}) with the new capacity variables.