Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
AWS Console and DynamoDB setup
📖 Scenario: You are starting a new project that needs a fast and scalable database. You will use AWS DynamoDB, a cloud database service, to store your data. First, you will set up the basic table structure in the AWS Console.
🎯 Goal: Build a DynamoDB table configuration with a primary key and a secondary index to prepare for storing user data efficiently.
📋 What You'll Learn
Create a DynamoDB table named Users with a primary key called UserID of type string.
Add a secondary index named EmailIndex with Email as the partition key of type string.
Set the read and write capacity units to 5 for both the table and the index.
💡 Why This Matters
🌍 Real World
DynamoDB is widely used for applications that need fast, scalable, and flexible NoSQL databases, such as user profiles, session stores, and real-time data.
💼 Career
Understanding how to configure DynamoDB tables is essential for cloud engineers, backend developers, and DevOps professionals working with AWS infrastructure.
Progress0 / 4 steps
1
Create the DynamoDB table structure
Create a DynamoDB table configuration dictionary named table_config with the table name Users and a primary key attribute named UserID of type S (string).
DynamoDB
Hint
Remember, the primary key uses KeySchema with KeyType set to HASH and the attribute type is S for string.
2
Add a secondary index configuration
Add a GlobalSecondaryIndexes entry to table_config with an index named EmailIndex. Use Email as the partition key of type S (string).
DynamoDB
Hint
Remember to add Email to AttributeDefinitions and define the GlobalSecondaryIndexes list with the index details.
3
Set provisioned throughput for the table
Add a ProvisionedThroughput entry to table_config with ReadCapacityUnits and WriteCapacityUnits both set to 5.
DynamoDB
Hint
The table's ProvisionedThroughput must be set outside the indexes with read and write units of 5.
4
Complete the DynamoDB table configuration
Ensure the table_config dictionary includes TableName, KeySchema, AttributeDefinitions, GlobalSecondaryIndexes, and ProvisionedThroughput with the exact values specified in previous steps.
DynamoDB
Hint
Review the entire table_config dictionary to ensure all parts are included and correctly set.
Practice
(1/5)
1. What is the main purpose of the primary key when creating a DynamoDB table in the AWS Console?
easy
A. To uniquely identify each item in the table
B. To set the read and write capacity
C. To define the table's region
D. To specify the encryption method
Solution
Step 1: Understand the role of the primary key
The primary key is used to uniquely identify each item in a DynamoDB table, ensuring no duplicates.
Step 2: Compare with other options
Read/write capacity, region, and encryption are important but unrelated to item uniqueness.
Final Answer:
To uniquely identify each item in the table -> Option A
Quick Check:
Primary key = unique item ID [OK]
Hint: Primary key always means unique ID for each item [OK]
Common Mistakes:
Confusing primary key with capacity settings
Thinking primary key sets table region
Assuming primary key controls encryption
2. Which of the following is the correct way to select the capacity mode when creating a DynamoDB table in the AWS Console?
easy
A. Set capacity mode to Manual or Automatic
B. Choose between On-Demand or Provisioned capacity modes
C. Select capacity mode as Static or Dynamic
D. Pick capacity mode as Fixed or Variable
Solution
Step 1: Recall DynamoDB capacity modes
DynamoDB offers two capacity modes: On-Demand (automatic scaling) and Provisioned (fixed capacity).
Step 2: Eliminate incorrect terms
Manual/Automatic, Static/Dynamic, Fixed/Variable are not official DynamoDB terms for capacity modes.
Final Answer:
Choose between On-Demand or Provisioned capacity modes -> Option B
Quick Check:
Capacity mode = On-Demand or Provisioned [OK]
Hint: Remember only On-Demand and Provisioned are valid capacity modes [OK]
Common Mistakes:
Using wrong terms like Manual or Static
Confusing capacity mode with encryption settings
Assuming capacity mode is set after table creation
3. You create a DynamoDB table with a primary key named OrderId and choose On-Demand capacity mode. What happens when you insert a new item with OrderId = 123?
medium
A. The table requires manual capacity increase before insertion
B. The item is rejected because capacity is not provisioned
C. The item is stored uniquely and capacity scales automatically
D. The item overwrites any existing item regardless of key
On-Demand mode automatically adjusts capacity to handle requests without manual provisioning.
Step 2: Consider primary key uniqueness
Primary key OrderId ensures the item with value 123 is stored uniquely; no overwriting unless key duplicates.
Final Answer:
The item is stored uniquely and capacity scales automatically -> Option C
Quick Check:
On-Demand + unique key = auto scale and store [OK]
Hint: On-Demand means no manual capacity needed [OK]
Common Mistakes:
Thinking On-Demand requires manual capacity setup
Assuming item overwrites existing without key conflict
Believing insertion fails without provisioned capacity
4. You tried to create a DynamoDB table in the AWS Console but got an error saying the primary key is missing. What should you do to fix this?
medium
A. Create the table without a primary key and add it later
B. Skip primary key and rely on DynamoDB to auto-generate it
C. Set the capacity mode to Provisioned to avoid the error
D. Specify a primary key attribute name and type before creating the table
Solution
Step 1: Recognize primary key requirement
DynamoDB requires a primary key defined at table creation to uniquely identify items.
Step 2: Correct the table setup
Specify the primary key attribute name (e.g., "UserId") and its data type (String or Number) in the AWS Console before creating the table.
Final Answer:
Specify a primary key attribute name and type before creating the table -> Option D
Quick Check:
Primary key must be set at creation [OK]
Hint: Always define primary key before creating table [OK]
Common Mistakes:
Expecting DynamoDB to auto-create primary key
Trying to create table without primary key
Changing capacity mode to fix primary key error
5. You want to create a DynamoDB table for a mobile app that has unpredictable traffic spikes. Which capacity mode should you choose in the AWS Console to optimize cost and performance?
hard
A. On-Demand capacity mode to handle variable traffic automatically
B. Provisioned capacity mode with fixed read/write units
C. Provisioned capacity mode with auto-scaling disabled
D. Manual capacity mode with scheduled scaling
Solution
Step 1: Analyze traffic pattern
Unpredictable traffic spikes require flexible capacity to avoid throttling or overspending.
Step 2: Choose capacity mode accordingly
On-Demand capacity mode automatically adjusts to traffic changes, optimizing cost and performance without manual intervention.
Step 3: Eliminate incorrect options
Provisioned with fixed units or disabled auto-scaling cannot handle spikes well; manual mode is not a DynamoDB option.
Final Answer:
On-Demand capacity mode to handle variable traffic automatically -> Option A
Quick Check:
Unpredictable traffic = On-Demand mode [OK]
Hint: Use On-Demand for apps with unpredictable traffic [OK]
Common Mistakes:
Choosing fixed provisioned capacity for variable traffic