0
0
AWScloud~10 mins

Creating a DynamoDB table in AWS - Visual Walkthrough

Choose your learning style9 modes available
Process Flow - Creating a DynamoDB table
Start
Define Table Name
Set Attribute Definitions
Set Key Schema
Set Provisioned Throughput
Call CreateTable API
Wait for Table Active
Table Ready to Use
End
This flow shows the steps to create a DynamoDB table: define name, attributes, keys, throughput, call API, wait until active, then use.
Execution Sample
AWS
aws dynamodb create-table \
  --table-name MusicCollection \
  --attribute-definitions AttributeName=Artist,AttributeType=S AttributeName=SongTitle,AttributeType=S \
  --key-schema AttributeName=Artist,KeyType=HASH AttributeName=SongTitle,KeyType=RANGE \
  --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
This command creates a DynamoDB table named MusicCollection with Artist as the partition key and SongTitle as the sort key.
Process Table
StepActionParametersAPI Call ResultState Change
1Define Table NameMusicCollectionN/ATableName set to MusicCollection
2Set Attribute DefinitionsArtist (S), SongTitle (S)N/AAttributes defined
3Set Key SchemaArtist as HASH, SongTitle as RANGEN/AKey schema set
4Set Provisioned ThroughputRead=5, Write=5N/AThroughput set
5Call CreateTable APIParameters from aboveTable status: CREATINGTable creation started
6Wait for Table ActivePolling table statusTable status: ACTIVETable ready to use
7EndN/AN/ACreation complete
💡 Table status becomes ACTIVE, creation process ends.
Status Tracker
VariableStartAfter Step 1After Step 2After Step 3After Step 4After Step 5After Step 6Final
TableNameundefinedMusicCollectionMusicCollectionMusicCollectionMusicCollectionMusicCollectionMusicCollectionMusicCollection
AttributeDefinitionsundefinedundefined[Artist:S, SongTitle:S][Artist:S, SongTitle:S][Artist:S, SongTitle:S][Artist:S, SongTitle:S][Artist:S, SongTitle:S][Artist:S, SongTitle:S]
KeySchemaundefinedundefinedundefined[Artist:HASH, SongTitle:RANGE][Artist:HASH, SongTitle:RANGE][Artist:HASH, SongTitle:RANGE][Artist:HASH, SongTitle:RANGE][Artist:HASH, SongTitle:RANGE]
ProvisionedThroughputundefinedundefinedundefinedundefined[Read=5, Write=5][Read=5, Write=5][Read=5, Write=5][Read=5, Write=5]
TableStatusundefinedundefinedundefinedundefinedundefinedCREATINGACTIVEACTIVE
Key Moments - 3 Insights
Why do we need to wait after calling CreateTable before using the table?
Because the table status is initially CREATING (see step 5 in execution_table). We must wait until the status changes to ACTIVE (step 6) before the table can be used.
What is the difference between AttributeDefinitions and KeySchema?
AttributeDefinitions define the data types of attributes (step 2), while KeySchema specifies which attributes are the primary keys (partition and sort keys) used to organize the table (step 3).
What happens if we set ProvisionedThroughput too low?
If throughput is too low (step 4), the table may throttle requests or perform slowly. It's important to set appropriate Read and Write capacity units.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at step 5, what is the TableStatus immediately after calling CreateTable API?
AACTIVE
BCREATING
CDELETING
DUPDATING
💡 Hint
Check the 'API Call Result' column at step 5 in execution_table.
At which step does the table become ready to use?
AStep 4
BStep 5
CStep 6
DStep 7
💡 Hint
Look for when TableStatus changes to ACTIVE in execution_table.
If you change the ProvisionedThroughput to Read=10, Write=10, which variable_tracker row changes?
AProvisionedThroughput
BKeySchema
CTableName
DAttributeDefinitions
💡 Hint
Check the ProvisionedThroughput row in variable_tracker.
Concept Snapshot
Create a DynamoDB table by specifying:
- TableName (unique name)
- AttributeDefinitions (name and type)
- KeySchema (partition and optional sort key)
- ProvisionedThroughput (read/write capacity)
Then call CreateTable API and wait until status is ACTIVE before use.
Full Transcript
Creating a DynamoDB table involves defining the table name, attributes, key schema, and throughput settings. After calling the CreateTable API, the table status is initially CREATING. We must wait until the status changes to ACTIVE before the table can be used. AttributeDefinitions specify data types, while KeySchema defines primary keys. ProvisionedThroughput sets read and write capacity units. This process ensures the table is properly configured and ready for operations.