Bird
Raised Fist0
DynamoDBquery~10 mins

Table capacity modes (on-demand vs provisioned) in DynamoDB - Visual Side-by-Side Comparison

Choose your learning style10 modes available

Start learning this pattern below

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
Concept Flow - Table capacity modes (on-demand vs provisioned)
Start
Choose Capacity Mode
On-Demand Mode
Auto scales
Pay per request
Handle Traffic
End
You start by choosing a capacity mode: on-demand auto-scales and charges per request, while provisioned requires setting fixed read/write units and paying for them.
Execution Sample
DynamoDB
CREATE TABLE MyTable (
  id STRING HASH KEY
) CAPACITY_MODE ON_DEMAND;
This creates a DynamoDB table with on-demand capacity mode, which automatically adjusts to traffic.
Execution Table
StepActionCapacity ModeRead Capacity Units (RCU)Write Capacity Units (WCU)BillingResult
1Create table with ON_DEMAND modeON_DEMANDAutoAutoPay per requestTable created with on-demand capacity
2Traffic increasesON_DEMANDAuto scales upAuto scales upCharges increase with usageCapacity adjusts automatically
3Traffic decreasesON_DEMANDAuto scales downAuto scales downCharges decrease with usageCapacity adjusts automatically
4Create table with PROVISIONED modePROVISIONED55Pay fixed unitsTable created with fixed capacity
5Traffic increases beyond capacityPROVISIONED55May throttle requestsPerformance may degrade
6Manually increase capacityPROVISIONED1010Pay fixed unitsCapacity increased manually
7Traffic normalizesPROVISIONED1010Pay fixed unitsCapacity remains fixed until changed
8End----Execution ends
💡 Execution ends after showing both modes handling traffic and billing differences.
Variable Tracker
VariableStartAfter Step 2After Step 3After Step 5After Step 6Final
Capacity ModeNot setON_DEMANDON_DEMANDPROVISIONEDPROVISIONEDPROVISIONED
Read Capacity Units (RCU)N/AAuto scales upAuto scales down51010
Write Capacity Units (WCU)N/AAuto scales upAuto scales down51010
BillingN/APay per requestPay per requestPay fixed unitsPay fixed unitsPay fixed units
Key Moments - 3 Insights
Why does on-demand mode not require setting read/write units?
Because on-demand mode automatically adjusts capacity based on traffic, as shown in execution_table rows 1-3 where capacity scales up and down without manual input.
What happens if traffic exceeds provisioned capacity?
Requests may be throttled causing performance issues, as seen in execution_table row 5 where fixed capacity is insufficient for increased traffic.
Does provisioned mode automatically reduce capacity when traffic decreases?
No, provisioned capacity stays fixed until manually changed, shown in rows 6-7 where capacity remains at 10 units despite traffic normalization.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what billing method is used in step 2 for on-demand mode?
APay fixed units
BPay per request
CFree
DSubscription
💡 Hint
Check the 'Billing' column in execution_table row 2.
At which step does provisioned mode capacity get manually increased?
AStep 6
BStep 5
CStep 4
DStep 7
💡 Hint
Look at the 'Action' column describing capacity changes in execution_table.
If traffic decreases in on-demand mode, what happens to capacity according to variable_tracker?
ACapacity stays the same
BCapacity increases
CCapacity decreases automatically
DCapacity must be manually adjusted
💡 Hint
See 'Read Capacity Units (RCU)' and 'Write Capacity Units (WCU)' changes after Step 3 in variable_tracker.
Concept Snapshot
DynamoDB tables have two capacity modes:
- On-Demand: Auto scales read/write capacity, pay per request.
- Provisioned: Set fixed read/write units, pay fixed cost.
On-Demand suits unpredictable traffic.
Provisioned suits steady, predictable workloads.
Choose mode based on traffic pattern and cost control.
Full Transcript
This visual execution shows how DynamoDB table capacity modes work. You start by choosing either on-demand or provisioned mode. On-demand mode automatically adjusts capacity units based on traffic, charging you per request. Provisioned mode requires you to set fixed read and write capacity units, paying a fixed cost regardless of usage. If traffic exceeds provisioned capacity, requests may be throttled until you manually increase capacity. On-demand mode scales capacity up and down automatically as traffic changes. This helps you understand billing differences and performance impacts between the two modes.

Practice

(1/5)
1. Which DynamoDB table capacity mode automatically adjusts to your application's traffic without requiring manual capacity settings?
easy
A. On-demand mode
B. Provisioned mode
C. Reserved mode
D. Manual mode

Solution

  1. Step 1: Understand capacity modes in DynamoDB

    DynamoDB offers two main capacity modes: on-demand and provisioned. On-demand mode automatically adjusts capacity based on traffic.
  2. Step 2: Identify the mode that adjusts automatically

    On-demand mode charges per request and scales automatically without manual settings, unlike provisioned mode which requires fixed capacity.
  3. Final Answer:

    On-demand mode -> Option A
  4. Quick Check:

    Automatic scaling = On-demand mode [OK]
Hint: Automatic scaling means on-demand mode [OK]
Common Mistakes:
  • Confusing provisioned mode as automatic
  • Thinking reserved or manual modes exist
  • Assuming manual capacity adjustment is automatic
2. Which of the following is the correct way to specify provisioned capacity when creating a DynamoDB table using AWS CLI?
easy
A. --billing-mode PAY_PER_REQUEST
B. --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
C. --capacity-mode ON_DEMAND
D. --read-write-capacity 10

Solution

  1. Step 1: Recall AWS CLI syntax for provisioned capacity

    Provisioned mode requires specifying read and write capacity units using --provisioned-throughput with ReadCapacityUnits and WriteCapacityUnits.
  2. Step 2: Match correct syntax option

    --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 uses the correct syntax. The --billing-mode PAY_PER_REQUEST and --capacity-mode ON_DEMAND options specify on-demand mode, while --read-write-capacity is invalid.
  3. Final Answer:

    --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 -> Option B
  4. Quick Check:

    Provisioned throughput syntax = --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 [OK]
Hint: Provisioned mode uses --provisioned-throughput flag [OK]
Common Mistakes:
  • Using PAY_PER_REQUEST flag for provisioned mode
  • Confusing capacity mode flags
  • Using invalid flags like --read-write-capacity
3. Consider a DynamoDB table in provisioned mode with ReadCapacityUnits=5 and WriteCapacityUnits=5. If your application suddenly sends 20 read requests per second, what will happen?
medium
A. All 20 read requests succeed without delay
B. The table switches to on-demand mode automatically
C. Some read requests may be throttled due to exceeding capacity
D. DynamoDB automatically increases capacity to handle 20 requests

Solution

  1. Step 1: Understand provisioned capacity limits

    Provisioned mode sets fixed read/write capacity units. Here, 5 read units allow about 5 strongly consistent reads per second.
  2. Step 2: Analyze traffic exceeding capacity

    Sending 20 read requests exceeds the provisioned 5 units. DynamoDB throttles excess requests instead of automatically scaling or switching modes.
  3. Final Answer:

    Some read requests may be throttled due to exceeding capacity -> Option C
  4. Quick Check:

    Exceeding provisioned units causes throttling [OK]
Hint: Provisioned mode throttles if requests exceed capacity [OK]
Common Mistakes:
  • Assuming automatic scaling in provisioned mode
  • Thinking all requests always succeed
  • Believing table switches modes automatically
4. You created a DynamoDB table with the following command:
aws dynamodb create-table --table-name MyTable --billing-mode PROVISIONED

But you forgot to specify provisioned throughput. What will happen?
medium
A. Table is created with default capacity of 5 read and 5 write units
B. Table is created but capacity is unlimited
C. Table is created in on-demand mode automatically
D. Table creation fails with an error about missing provisioned throughput

Solution

  1. Step 1: Check requirements for provisioned mode

    Provisioned mode requires specifying ReadCapacityUnits and WriteCapacityUnits explicitly during table creation.
  2. Step 2: Understand AWS CLI behavior on missing parameters

    Omitting provisioned throughput causes AWS CLI to return an error because required parameters are missing.
  3. Final Answer:

    Table creation fails with an error about missing provisioned throughput -> Option D
  4. Quick Check:

    Missing provisioned throughput causes creation error [OK]
Hint: Provisioned mode needs capacity units specified [OK]
Common Mistakes:
  • Assuming default capacity is assigned
  • Thinking table switches to on-demand mode
  • Believing capacity is unlimited without settings
5. A startup expects unpredictable traffic spikes but wants to control costs during low usage. Which DynamoDB capacity mode strategy is best to balance cost and performance?
hard
A. Use on-demand mode to automatically handle spikes and pay per request
B. Use provisioned mode with low capacity and manually increase during spikes
C. Use provisioned mode with high capacity to handle spikes
D. Switch between on-demand and provisioned modes daily

Solution

  1. Step 1: Analyze startup traffic pattern

    Unpredictable spikes mean traffic varies a lot, so automatic scaling is important to avoid throttling or overpaying.
  2. Step 2: Evaluate capacity mode options for cost and performance

    On-demand mode charges per request and scales automatically, ideal for unpredictable traffic and cost control. Provisioned mode requires manual adjustments and risks throttling or wasted capacity.
  3. Final Answer:

    Use on-demand mode to automatically handle spikes and pay per request -> Option A
  4. Quick Check:

    Unpredictable traffic = On-demand mode best [OK]
Hint: Unpredictable traffic? Choose on-demand mode [OK]
Common Mistakes:
  • Choosing high provisioned capacity wastes money
  • Manually adjusting capacity is slow and error-prone
  • Switching modes daily is not supported