AWS in 1 Min · Episode 117

DynamoDB on-demand vs provisioned, plus GSIs and LSIs

Capacity modes and indexes. Watch the one-minute video, then read the details.

David Gomez1:15 video · 3 min read

"With DynamoDB, you must guess your capacity up front." That was once the main headache of running DynamoDB. Today on-demand is the default and recommended capacity mode: you pay per request and there is nothing to plan. Provisioned capacity still exists, and it still wins for some workloads. This post covers both modes, then the two kinds of secondary index.

Two capacity modes

The capacity mode changes how the table scales and how you pay for reads and writes. Storage is billed separately in both.

On-demand

  • DynamoDB scales automatically. A new table can sustain up to 4,000 writes and 12,000 reads per second, and it instantly handles up to double its previous peak.
  • You pay per read and write request. If a table gets no traffic, there is no throughput charge.
  • Growth beyond double the previous peak in under 30 minutes can be throttled. For a known launch, AWS recommends pre-warming the table (warm throughput) or ramping up gradually.
  • You can set an optional maximum throughput per table or index to cap cost.

Provisioned

  • You set read capacity units and write capacity units per second (optionally with auto scaling).
  • You pay hourly for what you provisioned, whether you use it or not. Reserved capacity can lower that further.
  • It suits steady, predictable traffic you can forecast well.

You can switch a table from provisioned to on-demand up to four times in a rolling 24 hours, and back to provisioned at any time. A common mistake is the opposite of the myth: moving to provisioned to "save money" on a spiky table, then paying for idle capacity and still getting throttled at peaks.

Secondary indexes: more ways to query

A Query needs the table's partition key. When you need another lookup path, add a secondary index: DynamoDB copies (projects) attributes into it and keeps it updated automatically.

Global secondary index (GSI)

  • Uses a different partition key (and optional sort key), so it can query across the whole table, for example orders by email instead of by orderId.
  • Can be added or deleted at any time.
  • Reads are eventually consistent only, and it has its own throughput.
  • Default quota: 20 per table (adjustable).

Local secondary index (LSI)

  • Keeps the same partition key with a different sort key, for example a customer's orders by total instead of by date.
  • Must be created with the table; you cannot add or remove one later.
  • Supports strongly consistent reads, but limits each partition key value to 10 GB of data.
  • Limit: 5 per table.

In practice, GSIs are the everyday tool; reach for an LSI only when you need strong consistency on an alternate sort order and know the 10 GB limit will not bite.

Where AI fits

AI workloads are spiky: a batch of agent jobs or an embedding backfill hammers the table, then nothing happens for hours. On-demand follows the burst without capacity planning, and idle hours cost nothing for throughput. If the spike is a planned big launch, pre-warm the table first so it does not hit the doubling limit.

Quick recap

  • On-demand (default) for spiky or unknown traffic; provisioned for steady, forecastable traffic.
  • GSIs add new partition keys any time; LSIs add a new sort key, only at table creation.
  • Each index is a new query path: design them from your access patterns.
AWS in 1 Min #117 · 1:15

Need an AWS expert on your team?

I'm David, an AWS expert and fractional cloud consultant. I work alongside your team to run your cloud and infrastructure: architecture, security, cost and day-to-day operations. You get senior AWS experience when you need it, without the cost of a full-time hire.

  • Architecture reviews and a clear plan for what to fix first
  • Security hardening: IAM, networking, audits
  • Lower AWS bills without slowing your team down
  • Hands-on help with AI workloads on AWS