0
0
DynamoDBquery~30 mins

First table creation in DynamoDB - Mini Project: Build & Apply

Choose your learning style9 modes available
Create Your First DynamoDB Table
📖 Scenario: You are setting up a simple database table to store information about books in a library. Each book has a unique ID and a title.
🎯 Goal: Create a DynamoDB table named Books with a primary key called BookID of type string.
📋 What You'll Learn
Create a table named Books
Use BookID as the partition key
Set the partition key type to S (string)
Set the read and write capacity units to 5
💡 Why This Matters
🌍 Real World
Creating DynamoDB tables is a common task when setting up cloud databases for applications like online stores, mobile apps, or IoT devices.
💼 Career
Knowing how to create and configure DynamoDB tables is essential for cloud developers, database administrators, and backend engineers working with AWS.
Progress0 / 4 steps
1
Define the table name and key schema
Create a variable called table_name and set it to 'Books'. Then create a variable called key_schema that defines the partition key with AttributeName as 'BookID' and KeyType as 'HASH'.
DynamoDB
Need a hint?

Remember, the partition key is called BookID and its key type is HASH.

2
Define the attribute definitions and provisioned throughput
Create a variable called attribute_definitions that defines BookID as type 'S'. Then create a variable called provisioned_throughput with ReadCapacityUnits and WriteCapacityUnits both set to 5.
DynamoDB
Need a hint?

Attribute type 'S' means string. Set both read and write capacity units to 5.

3
Create the table creation parameters dictionary
Create a variable called table_params that combines table_name, key_schema, attribute_definitions, and provisioned_throughput into one dictionary with keys TableName, KeySchema, AttributeDefinitions, and ProvisionedThroughput respectively.
DynamoDB
Need a hint?

Combine all parts into one dictionary called table_params.

4
Add the final command to create the DynamoDB table
Create a variable called dynamodb_client that represents the DynamoDB client. Then create a variable called create_table_response that calls dynamodb_client.create_table() with table_params as the argument.
DynamoDB
Need a hint?

Use boto3.client('dynamodb') to create the client and call create_table() with the parameters.