An index in DynamoDB is a data structure that improves the speed of data retrieval operations on a table by allowing queries on non-primary key attributes.
Click to reveal answer
intermediate
How does a Global Secondary Index (GSI) affect capacity in DynamoDB?
A GSI consumes additional read and write capacity units because it maintains a copy of data with different key attributes, increasing the cost of operations.
Click to reveal answer
intermediate
What is the difference in write capacity cost between a table and its Local Secondary Index (LSI)?
Writes to a table also consume write capacity units for its LSI because the index is updated synchronously, but LSIs do not consume separate read capacity units since they share the table's read capacity.
Click to reveal answer
beginner
Why can adding too many indexes increase your DynamoDB costs?
Because each index requires additional storage and capacity units for writes and reads, more indexes mean more resources used, which increases your overall cost.
Click to reveal answer
intermediate
How can you reduce the cost impact of indexes in DynamoDB?
You can reduce costs by limiting the number of indexes, choosing only necessary attributes to project, and using on-demand capacity mode to pay only for what you use.
Click to reveal answer
Which type of index in DynamoDB requires separate read and write capacity units?
AGlobal Secondary Index (GSI)
BLocal Secondary Index (LSI)
CPrimary Key
DNo index requires capacity units
✗ Incorrect
Global Secondary Indexes consume separate read and write capacity units because they maintain a separate copy of data.
What happens to write capacity units when you write to a table with a Local Secondary Index?
AWrite capacity units are consumed for both the table and the LSI
BOnly the table consumes write capacity units
COnly the LSI consumes write capacity units
DNo write capacity units are consumed
✗ Incorrect
Writes to the table also consume write capacity units for the LSI because it updates synchronously.
Which of the following increases DynamoDB costs the most?
AProjecting only keys in indexes
BUsing only the primary key
CUsing on-demand capacity mode
DAdding multiple Global Secondary Indexes
✗ Incorrect
Multiple GSIs increase costs because each requires additional capacity and storage.
How can you reduce read capacity costs for an index?
AAdd more GSIs
BProject only necessary attributes
CUse larger read capacity units
DAvoid using indexes
✗ Incorrect
Projecting only necessary attributes reduces the size of data read, lowering read capacity costs.
Which index type shares read capacity units with the base table?
APrimary Key
BGlobal Secondary Index (GSI)
CLocal Secondary Index (LSI)
DNone
✗ Incorrect
LSIs share the table's read capacity units, unlike GSIs which have separate capacity.
Explain how Global Secondary Indexes affect DynamoDB capacity and cost.
Think about how GSIs duplicate data and require extra resources.
You got /4 concepts.
Describe strategies to manage and reduce the cost impact of indexes in DynamoDB.
Focus on minimizing resource use and paying only for what you need.
You got /4 concepts.
Practice
(1/5)
1. What is the main reason to use indexes in DynamoDB?
easy
A. To speed up query performance by allowing efficient data access
B. To reduce the storage size of the table
C. To automatically backup data
D. To encrypt data at rest
Solution
Step 1: Understand the purpose of indexes
Indexes in DynamoDB are designed to speed up queries by providing alternate ways to access data efficiently.
Step 2: Eliminate unrelated options
Options about storage size, backup, and encryption are unrelated to index functionality.
Final Answer:
To speed up query performance by allowing efficient data access -> Option A
Quick Check:
Indexes improve query speed = B [OK]
Hint: Indexes speed queries, not reduce storage or backup [OK]
Common Mistakes:
Thinking indexes reduce storage cost
Confusing indexes with backup features
Assuming indexes encrypt data
2. Which of the following is the correct way to specify a Global Secondary Index (GSI) in a DynamoDB table creation JSON?
C. {
"GlobalSecondaryIndexes": {
"IndexName": "MyGSI"
}
}
D. {
"Indexes": [
{
"Name": "MyGSI"
}
]
}
Solution
Step 1: Identify correct GSI syntax
Global Secondary Indexes require an array under "GlobalSecondaryIndexes" with full details: IndexName, KeySchema, Projection, and ProvisionedThroughput.
Step 2: Compare options
{
"GlobalSecondaryIndexes": [
{
"IndexName": "MyGSI",
"KeySchema": [
{"AttributeName": "UserId", "KeyType": "HASH"}
],
"Projection": {"ProjectionType": "ALL"},
"ProvisionedThroughput": {"ReadCapacityUnits": 5, "WriteCapacityUnits": 5}
}
]
} correctly uses "GlobalSecondaryIndexes" as an array with all required fields. Others use wrong keys or incomplete structures.
GSI syntax requires array with full details = A [OK]
Hint: GSIs need full details in GlobalSecondaryIndexes array [OK]
Common Mistakes:
Using LocalSecondaryIndexes instead of GlobalSecondaryIndexes
Providing object instead of array for GSIs
Omitting ProvisionedThroughput for GSIs
3. Given a DynamoDB table with a provisioned write capacity of 10 units and a Global Secondary Index (GSI) with 5 write capacity units, what is the total write capacity units consumed when writing one item to the table and the GSI?
medium
A. 5 units
B. 10 units
C. 15 units
D. 20 units
Solution
Step 1: Understand write capacity consumption
Writing one item consumes write capacity units on the main table plus on each index that is updated.
Step 2: Add main table and GSI write units
Main table uses 10 units, GSI uses 5 units, total = 10 + 5 = 15 units.
Final Answer:
15 units -> Option C
Quick Check:
Total write capacity = main + GSI = 15 [OK]
Hint: Add main table and index write units for total cost [OK]
Common Mistakes:
Counting only main table write units
Counting only GSI write units
Multiplying instead of adding capacities
4. You notice your DynamoDB table's write capacity is being exceeded even though your application writes only a few items per second. Which of the following is the most likely cause related to indexes?
medium
A. You have a Global Secondary Index with high write capacity units causing extra cost
B. You forgot to create any indexes
C. Your table has no read capacity units set
D. You are using Local Secondary Indexes which do not affect write capacity
Solution
Step 1: Analyze write capacity usage
Writes to the table also consume write capacity on GSIs, increasing total usage.
Step 2: Identify cause of exceeded capacity
If GSIs have high write capacity or many writes, they can cause capacity to be exceeded even if main table writes are low.
Final Answer:
You have a Global Secondary Index with high write capacity units causing extra cost -> Option A
Quick Check:
GSIs increase write capacity usage = C [OK]
Hint: Check GSIs for hidden write capacity usage [OK]
Common Mistakes:
Assuming no indexes means no extra capacity
Confusing read and write capacity units
Thinking Local Secondary Indexes increase write capacity
5. You want to optimize costs for a DynamoDB table with a Global Secondary Index (GSI). The table has 20 write capacity units and the GSI has 10 write capacity units. If your application writes 5 items per second, how can you reduce costs without affecting query performance on the GSI?
hard
A. Disable the table's write capacity units
B. Remove the GSI to save all index costs
C. Increase the table write capacity units to 30
D. Reduce the GSI write capacity units to 5 and enable auto scaling
Solution
Step 1: Understand cost drivers
Write capacity units on both table and GSI affect cost. Reducing GSI units lowers cost but must still handle write load.
Step 2: Apply auto scaling and adjust capacity
Reducing GSI write units to match actual writes (5) and enabling auto scaling balances cost and performance.
Final Answer:
Reduce the GSI write capacity units to 5 and enable auto scaling -> Option D
Quick Check:
Lower GSI units + auto scaling = cost optimization [OK]
Hint: Match GSI capacity to writes and use auto scaling [OK]
Common Mistakes:
Removing GSI and losing query performance
Increasing table capacity unnecessarily
Disabling write capacity causing failures
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.