Skip to content
Tutorials Center
My learning

Topics

Lesson 24 of 37 ยท Capacity, Consistency and Transactions

Capacity Modes: On-Demand and Provisioned

Calculate DynamoDB read and write capacity units, compare on-demand and provisioned modes, use auto scaling and reserved capacity, and avoid throttling.

DynamoDB bills for the work a request performs, measured in capacity units, not for servers. You choose between two capacity modes per table: on-demand, where you pay per request, and provisioned, where you reserve a rate per second and pay for it whether you use it or not. Understanding units helps you predict the bill and pick the right mode.

This lesson explains how read and write units are counted, how the two modes differ, how auto scaling and burst capacity work, and what happens when you go over.

Read and write capacity units

The counting rules, for a table in standard class:

Operation Unit One unit covers
Write (PutItem, UpdateItem, DeleteItem) WCU one write of up to 1 KB per second
Strongly consistent read RCU one read of up to 4 KB per second
Eventually consistent read 0.5 RCU one read of up to 4 KB
Transactional read 2 RCU one read of up to 4 KB
Transactional write 2 WCU one write of up to 1 KB

Sizes round up per item. A 1.2 KB item write costs 2 WCU. A 6 KB strongly consistent read costs 2 RCU (6 / 4 rounds up to 2), or 1 RCU eventually consistent. A Query that returns many items adds up the total size read (before any filter), rounded up to 4 KB, not the item count. This is why small items and projections matter. Consistency options are covered in consistency models.

Python Capacity unit calculator

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

On-demand mode

On-demand needs no capacity planning. You pay per request (priced per million read request units and write request units) and the table accommodates traffic up to twice the previous peak instantly, with more as it scales. Use it when:

  • traffic is unknown, new, spiky or mostly idle (dev, test, early products),
  • you want zero operational tuning.

It costs more per request than a well-used provisioned table. New tables have starting limits and quotas per table and account (check your region's current service quotas), and a sudden jump beyond double the previous peak can briefly throttle.

Provisioned mode

In provisioned mode you set read capacity units and write capacity units, a rate per second. You pay by the hour for that rate. It is cheaper for steady, predictable workloads.

With provisioned mode you can enable auto scaling (Application Auto Scaling). You set a minimum, a maximum and a target utilization (commonly 70%). CloudWatch alarms raise or lower capacity when usage stays above or below the target for a few minutes. It follows slow daily curves well, but reacts in minutes, so it is poor for sudden spikes.

Which mode?

On-demand Unknown or spiky traffic
Provisioned Steady, predictable traffic
Auto scaling Follows slow curves
Reserved Discount for a 1 or 3 year commitment

You can switch modes (limited frequency).

1 / 2

Burst capacity and throttling

DynamoDB keeps about five minutes of unused provisioned capacity to absorb short spikes. If you consume faster than provisioned and the burst is gone, a request fails with ProvisionedThroughputExceededException (HTTP 400). Writes that were rejected were not performed. The AWS SDKs retry with exponential backoff and jitter by default, so a few throttled requests usually never reach your code.

Python Simulate a token bucket with burst

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Choosing, and the cost levers

  1. Start with on-demand for a new workload. Measure for a few weeks in CloudWatch (ConsumedReadCapacityUnits, ConsumedWriteCapacityUnits).
  2. If the load is steady, move to provisioned with auto scaling and compare the monthly cost. The mode can be changed, but not more than once every 24 hours.
  3. For stable baseline usage, buy reserved capacity for the base rate; auto scaling handles the peaks above it.
  4. Use the Standard-IA (Infrequent Access) table class for tables that are mostly storage and rarely read: cheaper storage and higher per-request cost.
  5. Shrink the bill with smaller items, short attribute names for very large tables, projections that include only what you read, and eventually consistent reads where acceptable.

A control-plane example for the CLI (read-only here):

Terminal
aws dynamodb update-table --table-name Shop \
  --billing-mode PROVISIONED \
  --provisioned-throughput ReadCapacityUnits=100,WriteCapacityUnits=50

Limits per table and account (like the maximum RCU/WCU) change over time. Always read the current "Service quotas" page of your region rather than trusting a number from a tutorial.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. How many WCU does one write of a 2.3 KB item consume?

    One WCU covers 1 KB and sizes round up, so 2.3 KB needs 3 WCU.
  2. 2. How many RCU does an eventually consistent read of an 8 KB item consume?

    8 KB is two 4 KB blocks, which is 2 RCU strongly consistent and half of that, 1 RCU, eventually consistent.
  3. 3. When is on-demand mode the best fit?

    On-demand removes planning at a higher per-request price. Steady high volumes are cheaper provisioned.
  4. 4. What does the SDK do by default when a request is throttled?

    AWS SDKs retry throttled requests with backoff. Persistent throttling still raises an exception to your code.

Summary

  • 1 WCU = one 1 KB write per second; 1 RCU = one strongly consistent 4 KB read per second (eventual is half, transactions double).
  • Sizes round up, and a Query is charged on the data it reads, not on what survives a filter.
  • On-demand suits unknown or spiky loads; provisioned with auto scaling suits steady loads and is cheaper at volume.
  • About five minutes of unused capacity is banked as burst; beyond it requests throttle and SDKs retry.
  • Reserved capacity and the Standard-IA table class cut cost further.

Next: Consistency Models