Amazon DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability.
Click to reveal answer
beginner
What is a primary key in a DynamoDB table?
A primary key uniquely identifies each item in a DynamoDB table. It can be a simple primary key (partition key) or a composite primary key (partition key and sort key).
Click to reveal answer
intermediate
Why do you need to specify read and write capacity units when creating a DynamoDB table?
Read and write capacity units define the throughput capacity for the table, controlling how many reads and writes per second the table can handle. This helps manage performance and cost.
Click to reveal answer
intermediate
What is the difference between on-demand and provisioned capacity modes in DynamoDB?
On-demand capacity automatically adjusts to your workload and charges per request, while provisioned capacity requires you to specify read/write units and is better for predictable workloads.
Click to reveal answer
advanced
What is a Global Secondary Index (GSI) in DynamoDB?
A Global Secondary Index is an index with a partition key and optional sort key that can be different from the base table's primary key, allowing efficient queries on different attributes.
Click to reveal answer
Which of the following is required when creating a DynamoDB table?
APrimary key definition
BVPC configuration
CSubnet group
DIAM user password
✗ Incorrect
Every DynamoDB table must have a primary key defined to uniquely identify items.
What does a partition key in DynamoDB do?
AEncrypts data
BDefines table backup schedule
CDistributes data across partitions
DLimits table size
✗ Incorrect
The partition key determines how data is distributed across storage partitions for scalability.
Which capacity mode charges you based on the number of reads and writes you perform?
ABurst capacity
BProvisioned capacity
CReserved capacity
DOn-demand capacity
✗ Incorrect
On-demand capacity mode charges per request and automatically scales with your workload.
What is the purpose of a sort key in a DynamoDB table?
ATo sort items with the same partition key
BTo set read capacity
CTo define table region
DTo encrypt data
✗ Incorrect
The sort key allows multiple items with the same partition key to be stored and sorted.
Which feature allows querying a DynamoDB table using an alternate key?
ALocal Secondary Index
BGlobal Secondary Index
CPrimary Key
DBackup and Restore
✗ Incorrect
Global Secondary Indexes let you query the table using different keys than the primary key.
Explain the steps to create a DynamoDB table with a simple primary key.
Think about what you need to uniquely identify items and how you want to handle capacity.
You got /4 concepts.
Describe the difference between provisioned and on-demand capacity modes in DynamoDB and when to use each.
Consider workload predictability and cost management.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of the primary key when creating a DynamoDB table?
easy
A. To define the table's read capacity
B. To store the table's name
C. To specify the AWS region
D. To uniquely identify each item in the table
Solution
Step 1: Understand the role of the primary key
The primary key uniquely identifies each item in a DynamoDB table, ensuring no duplicates.
Step 2: Differentiate from other table properties
Table name, capacity, and region do not serve as unique identifiers for items.
Final Answer:
To uniquely identify each item in the table -> Option D
Quick Check:
Primary key = unique item ID [OK]
Hint: Primary key means unique ID for each item [OK]
Common Mistakes:
Confusing primary key with table name
Thinking capacity defines uniqueness
Mixing region with key attributes
2. Which AWS CLI command correctly creates a DynamoDB table named Users with a primary key UserId of type string?
But you get an error. What is the most likely cause?
medium
A. The attribute definition and key schema attribute names do not match
B. Provisioned throughput values are missing
C. The key schema is missing a RANGE key
D. AttributeType should be 'S' for string, not 'N' for number
Solution
Step 1: Check attribute definitions and key schema names
The attribute definitions specify AttributeName=Id, but the key schema specifies AttributeName=OrderId. The names do not match, causing the error.
Step 2: Verify other potential issues
Provisioned throughput values are present (not B), a simple primary key with only HASH is allowed (not C), AttributeType=N is valid for numeric IDs (not D).
Final Answer:
The attribute definition and key schema attribute names do not match -> Option A
Quick Check:
Attribute names must match exactly [OK]
Hint: Match attribute names exactly in definitions and key schema [OK]
Common Mistakes:
Assuming 'N' type is invalid
Expecting RANGE key for all tables
Missing provisioned throughput
5. You want to create a DynamoDB table named Sessions with a composite primary key: UserId (string) as HASH and SessionId (string) as RANGE. You also want to set autoscaling for read and write capacity. Which of the following is the best approach?
hard
A. Create the table without specifying key schema and add keys later
B. Use aws dynamodb create-table with attribute definitions and key schema, then configure autoscaling via Application Auto Scaling service
C. Use aws dynamodb create-table with only HASH key and enable autoscaling in the same command
D. Create the table with fixed provisioned throughput and manually update capacity when needed
Solution
Step 1: Define table with composite primary key
Use create-table with attribute definitions for UserId and SessionId, and key schema with HASH and RANGE keys.
Step 2: Configure autoscaling separately
DynamoDB autoscaling is set up via Application Auto Scaling service after table creation; it cannot be enabled directly in create-table command.
Final Answer:
Use aws dynamodb create-table with attribute definitions and key schema, then configure autoscaling via Application Auto Scaling service -> Option B
Quick Check:
Composite key + separate autoscaling setup = Use aws dynamodb create-table with attribute definitions and key schema, then configure autoscaling via Application Auto Scaling service [OK]
Hint: Create table first, then set autoscaling separately [OK]
Common Mistakes:
Trying to enable autoscaling in create-table command
Skipping RANGE key for composite key
Creating table without key schema
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.