0
0
AWScloud~30 mins

Creating a DynamoDB table in AWS - Try It Yourself

Choose your learning style9 modes available
Creating a DynamoDB table
📖 Scenario: You are working on a cloud project where you need to store user data in a fast and scalable database. Amazon DynamoDB is a great choice because it is a managed NoSQL database service that can handle large amounts of data with low latency.In this project, you will create a DynamoDB table step-by-step using AWS CloudFormation syntax. This will help you understand how to define cloud infrastructure as code.
🎯 Goal: Create a DynamoDB table named UserData with a primary key called UserId of type string. You will define the table structure, add a provisioned throughput configuration, and complete the CloudFormation resource definition.
📋 What You'll Learn
Create a CloudFormation resource for a DynamoDB table named UserData
Define the primary key attribute UserId as a string
Set the provisioned throughput with read capacity units 5 and write capacity units 5
Complete the CloudFormation resource with all required properties
💡 Why This Matters
🌍 Real World
DynamoDB tables are widely used in cloud applications to store user profiles, session data, and other fast-access information.
💼 Career
Understanding how to define DynamoDB tables in infrastructure as code is essential for cloud engineers and developers working with AWS.
Progress0 / 4 steps
1
Define the DynamoDB table resource
Create a CloudFormation resource named UserData of type AWS::DynamoDB::Table. Inside it, add the Properties key with an empty dictionary. This will be the base for your DynamoDB table definition.
AWS
Need a hint?

Start by defining the resource name UserData and set its type to AWS::DynamoDB::Table. Add an empty Properties block.

2
Add the primary key attribute
Inside the Properties of UserData, add the AttributeDefinitions list with one item. This item should have AttributeName set to UserId and AttributeType set to S (string). Also add the KeySchema list with one item where AttributeName is UserId and KeyType is HASH.
AWS
Need a hint?

Define the attribute UserId as a string in AttributeDefinitions. Then set it as the partition key in KeySchema with KeyType HASH.

3
Add provisioned throughput configuration
Inside the Properties of UserData, add the ProvisionedThroughput key. Set ReadCapacityUnits to 5 and WriteCapacityUnits to 5. This configures the read and write capacity for the table.
AWS
Need a hint?

Add ProvisionedThroughput with ReadCapacityUnits and WriteCapacityUnits both set to 5.

4
Complete the DynamoDB table resource
Ensure the CloudFormation resource UserData includes Type as AWS::DynamoDB::Table and Properties with AttributeDefinitions, KeySchema, and ProvisionedThroughput exactly as specified. This completes the DynamoDB table definition.
AWS
Need a hint?

Check that the resource UserData has all required properties correctly defined.