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_
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_
Storage is $0.25/GB-month regardless of capacity mode.
c3x reads geo_
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_.
| Dimension | Unit | What's being charged |
|---|---|---|
| Provisioned RU/s | per 100 RU/s per hour | Throughput 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/s | per 100 RU/s per hour | Bills at the highest hour of usage within autoscale's 10-100% range. $0.012/100 RU/s/hour at peak |
| Serverless RU consumption | per 1M RU consumed | Pay per request only. No provisioning required. $0.25/1M RU |
| Storage | per GB-month | Data plus indexes. Same rate across capacity modes. $0.25/GB-month |
| Backup (continuous tier) | per GB-month | Continuous backup for point-in-time restore. Standard tier is $0.20/GB-month for 7-day retention. |
| Multi-region replicas | multiplier | Each additional geo_ |
Optimization tips
Common ways to reduce azurerm_ cost without changing the workload.
Use autoscale instead of fixed throughput
Up to 50% for variable workloadsAutoscale 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-utilizationPay-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 throughputMulti-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 timeMany 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_
How does c3x estimate Cosmos DB cost?
For provisioned mode: c3x reads throughput from azurerm_
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
More Azure resources
Further reading
- Azure Cosmos DB autoscale cost: when the 50% premium pays off
Cosmos DB autoscale raises the per-RU/s rate by 50 percent but scales throughput automatically between 10 percent and 100 percent of a maximum. For variable traffic it can be cheaper than standard provisioned; for flat traffic it is a needless premium. Here is the math.
- Azure Cosmos DB multi-region cost: what each replica region adds
Adding a region to Cosmos DB multiplies your throughput cost by the number of regions, and enabling multi-region writes multiplies it further. Global distribution is powerful but priced per region. Here is how to weigh the cost against the benefit.
- Azure Cosmos DB RU cost optimization: stop over-provisioning throughput
Cosmos DB bills by provisioned RU/s (~$0.008 per 100 RU/s-hour) times region count. Over-provisioned throughput and needless multi-region writes are the big overspends. Here's how to right-size and which throughput model to pick.
- 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.
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_.