0
0
DynamoDBquery~30 mins

Hierarchical data modeling in DynamoDB - Mini Project: Build & Apply

Choose your learning style9 modes available
Hierarchical Data Modeling in DynamoDB
📖 Scenario: You are building a simple employee directory for a company. Each employee can have a manager, creating a hierarchy. You want to store this data in DynamoDB so you can easily find employees and their managers.
🎯 Goal: Create a DynamoDB table to store employees with their manager relationships using hierarchical data modeling. You will define the table structure, add a configuration for the partition key, insert employee data, and finalize the table setup.
📋 What You'll Learn
Create a DynamoDB table named Employees with EmployeeID as the partition key.
Add a configuration variable for the sort key named ManagerID.
Insert employee items with EmployeeID, Name, and ManagerID attributes.
Complete the table creation with the key schema and attribute definitions.
💡 Why This Matters
🌍 Real World
Companies often need to store employee-manager relationships to manage organizational charts and reporting structures.
💼 Career
Understanding hierarchical data modeling in DynamoDB is useful for roles involving cloud database design, backend development, and data engineering.
Progress0 / 4 steps
1
Create the DynamoDB table with partition key
Write the AWS CLI command to create a DynamoDB table named Employees with EmployeeID as the partition key of type String.
DynamoDB
Need a hint?

Use the aws dynamodb create-table command with --table-name Employees. Define EmployeeID as the partition key with type String (S).

2
Add sort key configuration for ManagerID
Modify the AWS CLI command to add ManagerID as the sort key of type String in the table creation.
DynamoDB
Need a hint?

Add ManagerID as a sort key (range key) with type String in both --attribute-definitions and --key-schema.

3
Insert employee items with manager relationships
Write AWS CLI commands to insert two employees: EmployeeID 'E1' named 'Alice' with no manager (empty string), and EmployeeID 'E2' named 'Bob' with manager 'E1'. Use put-item with JSON item data.
DynamoDB
Need a hint?

Use aws dynamodb put-item to add each employee. The ManagerID for Alice is an empty string to indicate no manager.

4
Complete the table setup with key schema and attribute definitions
Ensure the AWS CLI command for creating the Employees table includes both EmployeeID as the partition key and ManagerID as the sort key with correct attribute definitions and key schema.
DynamoDB
Need a hint?

Double-check the table creation command includes both keys in attribute definitions and key schema.