azurecosmos-dbdatabasecost-optimization

Azure Cosmos DB serverless cost: pay per request unit consumed

Cosmos DB serverless bills per request unit (RU) consumed plus storage, with no provisioned throughput to pay for when idle. It suits spiky or low-traffic workloads; steady high traffic is cheaper on provisioned throughput. Here is how to choose.

The C3X Team··5 min read

Quick answer

Cosmos DB serverless bills only for the request units (RUs) you consume (around $0.25 per million RUs) plus storage, with nothing to pay when idle. It suits spiky, low-traffic, or unpredictable workloads. For steady, high-throughput workloads, provisioned throughput (especially autoscale or reserved) is cheaper per request. Match the mode to your traffic shape.

Cosmos DB offers two billing models, and picking the wrong one is the most common Cosmos overspend. Serverless charges purely for consumed request units; provisioned throughput reserves RU capacity by the hour. The decision is the familiar spiky-versus-steady tradeoff.

Serverless: pay per RU

In serverless mode you pay about $0.25 per million request units actually consumed, plus storage, with no reserved capacity. An idle database costs only storage, and a bursty one costs in proportion to its requests. There is no throughput to size and no idle capacity to pay for.

Serverless vs provisioned

ModeBills forBest when
ServerlessRUs consumed + storageSpiky, low, or unpredictable traffic
Provisioned (manual)Reserved RU/s, hourlySteady, predictable high traffic
Provisioned (autoscale)RU/s up to a max, hourlyVariable but sustained traffic

Provisioned throughput reserves RU/s and is cheaper per request at steady, high volume, and reserved-capacity discounts lower it further. Autoscale provisioned throughput is a middle ground that scales RU/s within a band. The same logic as optimizing Cosmos RU cost applies: match the mode to the traffic.

Controlling serverless cost

Because you pay per RU, the levers are query efficiency and data model: index only what you query, avoid cross-partition scans, and use point reads where possible, all of which lower RU consumption per operation. Cache hot reads to deflect RUs entirely, the caching lever. And if a serverless workload grows into steady high traffic, re-evaluate against provisioned throughput, since the crossover moves as volume rises.

FAQ

How is Cosmos DB serverless priced?

Per request unit consumed, around $0.25 per million RUs, plus storage, with no reserved throughput to pay for when idle. An idle database costs only storage, and a busy one costs in proportion to the RUs its operations consume.

Is Cosmos serverless cheaper than provisioned?

For spiky, low, or unpredictable traffic, yes, because you avoid paying for reserved throughput that sits idle. For steady, high-throughput workloads, provisioned throughput (especially autoscale or reserved) is cheaper per request. Match the mode to your traffic shape.

What is a request unit in Cosmos DB?

The normalized unit of throughput cost. Every operation consumes RUs based on its complexity, item size, and indexing, so a point read costs few RUs and a cross-partition query costs many. In serverless mode you pay per RU consumed.

How do I reduce Cosmos serverless cost?

Lower RU consumption per operation: index only what you query, avoid cross-partition scans, use point reads where possible, and cache hot reads to deflect RUs. If a serverless workload grows into steady high traffic, compare against provisioned throughput.

When should I switch from serverless to provisioned?

When traffic becomes steady and high enough that reserved RU/s cost less than the per-RU serverless charge for the same volume. As traffic grows the crossover favors provisioned, and reserved-capacity discounts lower provisioned cost further.

Does C3X estimate Cosmos DB cost?

C3X prices the azurerm_cosmosdb_account and its throughput configuration from your Terraform, so provisioned throughput cost appears before deploy. For serverless, RU consumption is a usage input you model, since it depends on query volume and efficiency.

What to do next

Compare serverless and provisioned before you choose. C3X reads your Terraform and prices Cosmos DB and the rest of your stack against a live catalog. Start with the quickstart.

Try C3X on your own Terraform

Free and open source. No API key required. One command to install, one command to estimate.