Read and write capacity units control how much data you can read or write in your DynamoDB table per second. They help keep your app fast and reliable.
Read and write capacity units in DynamoDB
Start learning this pattern below
Jump into concepts and practice - no test required
ProvisionedThroughput={
ReadCapacityUnits: number,
WriteCapacityUnits: number
}ReadCapacityUnits means how many strongly consistent reads per second you want.
WriteCapacityUnits means how many writes per second you want.
ProvisionedThroughput={
ReadCapacityUnits: 5,
WriteCapacityUnits: 10
}ProvisionedThroughput={
ReadCapacityUnits: 1,
WriteCapacityUnits: 1
}This command creates a DynamoDB table named 'MyTable' with 5 read and 5 write capacity units.
aws dynamodb create-table \ --table-name MyTable \ --attribute-definitions AttributeName=Id,AttributeType=S \ --key-schema AttributeName=Id,KeyType=HASH \ --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
One read capacity unit can handle one strongly consistent read per second for items up to 4 KB in size.
One write capacity unit can handle one write per second for items up to 1 KB in size.
If your items are larger, DynamoDB uses more capacity units per operation.
Read and write capacity units set how many reads and writes your DynamoDB table can handle per second.
They help keep your app fast and avoid errors from too many requests.
You can adjust them to control costs and performance.
Practice
Solution
Step 1: Understand capacity units meaning
Read and write capacity units define how many read and write operations a DynamoDB table can perform each second.Step 2: Identify what capacity units control
They control throughput, not storage size, number of tables, or security settings.Final Answer:
The number of reads and writes the table can handle per second -> Option AQuick Check:
Capacity units = throughput control [OK]
- Confusing capacity units with storage size
- Thinking capacity units control security
- Assuming capacity units limit number of tables
Solution
Step 1: Recall AWS CLI syntax for capacity units
The correct syntax uses --provisioned-throughput with ReadCapacityUnits and WriteCapacityUnits keys.Step 2: Match options with correct syntax
--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=10 matches the exact syntax; others use incorrect keys or formats.Final Answer:
--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=10 -> Option BQuick Check:
Correct CLI syntax = --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=10 [OK]
- Using incorrect keys like ReadUnits or WriteUnits
- Missing commas or using wrong separators
- Confusing throughput with capacity keywords
Solution
Step 1: Understand write capacity unit size
One write capacity unit allows one write per second for an item up to 1 KB.Step 2: Calculate writes for 2 KB items
Each 2 KB item requires 2 write capacity units. With 10 units, 10 / 2 = 5 writes per second.Final Answer:
5 writes per second -> Option AQuick Check:
Write capacity units / item size factor = writes/sec [OK]
- Assuming 1 unit = 2 KB write
- Not dividing capacity units by item size
- Confusing read and write capacity units
Solution
Step 1: Recall read capacity unit size
One read capacity unit supports one strongly consistent read per second for an item up to 4 KB.Step 2: Analyze throttling cause
If items are larger than 4 KB, each read consumes multiple units, so 5 units may not support 3 reads per second.Final Answer:
Each read item is larger than 4 KB, requiring more capacity units -> Option CQuick Check:
Item size affects read capacity usage [OK]
- Blaming write capacity units for read throttling
- Ignoring item size impact on capacity
- Thinking region or storage size causes throttling
Solution
Step 1: Understand capacity modes
DynamoDB offers on-demand mode that adjusts capacity automatically to traffic, optimizing cost and performance.Step 2: Compare options for cost efficiency
Setting high fixed units wastes money; manual changes are slow; zero units disables table. On-demand is best for variable traffic.Final Answer:
Use on-demand capacity mode to automatically adjust units based on traffic -> Option DQuick Check:
On-demand mode = auto scaling capacity [OK]
- Setting fixed high capacity wastes money
- Manually adjusting capacity is inefficient
- Setting zero units disables table access
