Module 4: DynamoDB (NoSQL Databases)
DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability.
Why DynamoDB?
Traditional databases use tables with fixed columns. DynamoDB is more flexible—it's like a giant, lightning-fast spreadsheet that can grow to any size.
Mission: The User Registry
You are building a registry for a new app. You need to store user IDs and names.
Step 1: Create the Table
We need to define the Partition Key (UserId). This is how DynamoDB finds our data.
Run: aws dynamodb create-table --table-name Users --attribute-definitions AttributeName=UserId,AttributeType=S --key-schema AttributeName=UserId,KeyType=HASH --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
Step 2: Save Data
Now, let's add our first user, "John Doe", to the database.
Run: aws dynamodb put-item --table-name Users --item '{"UserId": {"S": "user_1"}, "Name": {"S": "John Doe"}}'