AzureAzure Cosmos DBDatabase

azurerm_cosmosdb_account cost estimation

A globally-distributed multi-model database. Priced by Request Units (RU/s) and storage, with provisioned and serverless options.

An azurerm_cosmosdb_account is the top-level resource for Azure Cosmos DB, a managed NoSQL database with support for multiple data models (SQL, MongoDB, Cassandra, Table, Gremlin). Pricing is dominated by Request Units per second (RU/s) provisioned and storage consumed.

Three capacity modes change the cost model substantially:

Provisioned throughput: you provision RU/s at the database or container level. Standard rate is roughly $0.008/100 RU/s per hour. A container with 1,000 RU/s costs ~$58/month for throughput alone. With autoscale, you set a max and the system scales between 10% and 100% of that max, with billing at the highest hour of the day.

Serverless: pay per request unit consumed ($0.25/M RU consumed) and per GB stored. Right for unpredictable workloads with low to moderate baseline. No minimum throughput. Cap of 5,000 RU/s per container.

Continuous backup (point-in-time restore): adds ~$0.20/GB-month for the backup tier (continuous7) or higher for continuous30.

Multi-region writes (geo_location with multiple entries): each additional region replicates your data and provisioned throughput, multiplying the cost roughly by the region count.

Storage is $0.25/GB-month regardless of capacity mode.

c3x reads geo_location, capabilities (for serverless), and any provisioned throughput defined on databases/containers. Without serverless usage data, c3x assumes constant max-RU consumption.

Terraform example

A minimal but realistic configuration that C3X can estimate.

resource "azurerm_cosmosdb_account" "main" {
  name                = "production-cosmos"
  location            = azurerm_resource_group.main.location
  resource_group_name = azurerm_resource_group.main.name
  offer_type          = "Standard"
  kind                = "GlobalDocumentDB"

  consistency_policy {
    consistency_level = "Session"
  }

  geo_location {
    location          = "eastus"
    failover_priority = 0
  }

  geo_location {
    location          = "westus2"
    failover_priority = 1
  }

  capabilities {
    name = "EnableServerless"
  }
}

Pricing dimensions

What you actually pay for when you provision azurerm_cosmosdb_account.

DimensionUnitWhat's being charged
Provisioned RU/sper 100 RU/s per hourThroughput provisioned at the database or container level. Continuous billing regardless of utilization.
$0.008/100 RU/s/hour ≈ $5.84/100 RU/s/month
Autoscale RU/sper 100 RU/s per hourBills at the highest hour of usage within autoscale's 10-100% range.
$0.012/100 RU/s/hour at peak
Serverless RU consumptionper 1M RU consumedPay per request only. No provisioning required.
$0.25/1M RU
Storageper GB-monthData plus indexes. Same rate across capacity modes.
$0.25/GB-month
Backup (continuous tier)per GB-monthContinuous backup for point-in-time restore. Standard tier is $0.20/GB-month for 7-day retention.
Multi-region replicasmultiplierEach additional geo_location replicates data and provisioned throughput.

Optimization tips

Common ways to reduce azurerm_cosmosdb_account cost without changing the workload.

Use autoscale instead of fixed throughput

Up to 50% for variable workloads

Autoscale charges 50% more per peak hour but scales between 10% and 100%. For workloads that don't sustain peak, total cost is usually lower than provisioning to peak 24/7.

Use serverless for sporadic workloads

Up to 90% on low-utilization

Pay-per-request only. Right for development, testing, and applications with very low baseline. Crossover with provisioned is around 30% sustained utilization.

Co-locate writes to single region when possible

33-67% on throughput

Multi-region writes are right for global apps but double or triple the bill. For workloads that don't require write availability in multiple regions, single-write-region with read replicas is much cheaper.

Buy Reserved Capacity for steady-state

20-65%

Azure Reserved Capacity for Cosmos DB cuts provisioned throughput by 20-65% for 1- or 3-year commitments. Right for stable production workloads.

Right-size by analyzing RU consumption

Major over time

Many Cosmos DB containers are overprovisioned. Check Azure Monitor for NormalizedRUConsumption. If consistently below 30%, drop the provisioned throughput.

FAQ

Serverless or provisioned?

Serverless wins for unpredictable, low-baseline workloads (dev, sporadic queries, multi-tenant apps with thin tenants). Provisioned wins for steady-state workloads above ~30% utilization. Autoscale is the middle ground that's often best for production.

Does multi-region replication double the cost?

Approximately, yes. Each additional region replicates storage and provisioned throughput. If multi-write is enabled (enable_multiple_write_locations = true), it also costs more per RU. Single-write-region with multi-read-region is the cheapest geo-distributed setup.

How does c3x estimate Cosmos DB cost?

For provisioned mode: c3x reads throughput from azurerm_cosmosdb_sql_database and azurerm_cosmosdb_sql_container resources. For serverless: requires monthly_request_units in c3x-usage.yml.

What about Cosmos DB for MongoDB?

Same Cosmos DB account resource, different API selection (capabilities = ['EnableMongo']). Pricing is identical: RU/s and storage, regardless of which API.

Related resources

Estimate this resource in your own Terraform

Free, open source, no API key. C3X parses your Terraform and shows line-item cost for every resource, including azurerm_cosmosdb_account.