azurerm_servicebus_namespace cost estimation
Enterprise messaging with queues and topics. Basic ($0.05/M operations), Standard ($0.0135/hour + $0.80/M operations), Premium ($0.99/hour per Messaging Unit). Premium for VNet isolation, predictable performance.
Azure Service Bus is the managed enterprise messaging service. The azurerm_servicebus_namespace resource creates the namespace; queues and topics are configured separately. Pricing tiers differ significantly in features and cost.
Basic tier: - $0.05 per million operations - Queues only (no topics/subscriptions) - No transactions, no sessions, no dead-letter - Right for very simple async messaging
Standard tier: - $0.0135/hour base ($9.86/month) - $0.80 per million operations beyond first 12.5M/month included - Queues + Topics + Subscriptions - 256 KB message size, 5 GB queue size - Most general-purpose async messaging
Premium tier: - $0.99/hour per Messaging Unit ($722/month per MU) - 1-16 Messaging Units per namespace - Dedicated capacity, no operation fees - VNet integration, customer-managed keys - Up to 100 MB messages, 80 GB queue - Right for high-throughput, regulated workloads
A typical Standard workload: 10M operations/day = 300M/month. Beyond included 12.5M, that's 287.5M × $0.80 = $230 + $9.86 base = $240/month.
The same workload on Premium (1 MU): $722/month. Premium is 3x more expensive but has dedicated capacity, no throttling, larger messages.
Common cost surprises: - Each receive/send/peek/abandon/complete is one operation. A receive + complete is 2 operations. - Dead-letter queue operations count separately - Subscription receives are billed per-subscription (1 send to 3 subscriptions = 3 receive operations to bill)
c3x estimates Service Bus based on SKU and (via c3x-usage.yml) expected operations or Messaging Unit count.
Terraform example
A minimal but realistic configuration that C3X can estimate.
resource "azurerm_servicebus_namespace" "main" {
name = "prod-servicebus"
location = azurerm_resource_group.main.location
resource_group_name = azurerm_resource_group.main.name
sku = "Standard"
tags = {
Environment = "production"
}
}
resource "azurerm_servicebus_queue" "orders" {
name = "orders"
namespace_id = azurerm_servicebus_namespace.main.id
default_message_ttl = "P14D"
enable_partitioning = false
max_size_in_megabytes = 5120
dead_lettering_on_message_expiration = true
}Pricing dimensions
What you actually pay for when you provision azurerm_servicebus_namespace.
| Dimension | Unit | What's being charged |
|---|---|---|
| Basic operations | per million | Operations on Basic tier namespaces. Cheapest tier but lacks features. $0.05 per 1M operations |
| Standard base + operations | per hour + per million | Standard tier base fee plus operations beyond 12.5M/month included. $0.0135/hour + $0.80 per 1M operations |
| Premium Messaging Units | per MU-hour | Dedicated capacity. 1-16 MUs per namespace. No per-operation fees. $0.99/MU-hour ($722/month per MU) |
| Geo-disaster recovery | free with Premium | Pairing namespaces across regions for failover. Premium only. Free with Premium tier |
Optimization tips
Common ways to reduce azurerm_servicebus_namespace cost without changing the workload.
Use Basic for simple async patterns
Up to 95% vs PremiumIf you only need queues (no topics, no transactions, no sessions), Basic at $0.05/M operations is the cheapest tier. For workloads under 1M ops/day, costs are minimal.
Batch operations to reduce count
Up to 99% reductionEach Send is one operation. Sending 100 messages individually = 100 operations. Sending one batch of 100 = 1 operation. Batch operations cut cost proportionally. Same for Receive.
Use prefetch to reduce receive operations
80%+ on receive operationsPrefetchCount lets the client pull multiple messages in one operation. Set prefetch to expected processing batch size. Reduces receive operations 10x or more.
Skip Premium unless you need its specific features
70%+ vs PremiumPremium is 3-5x more expensive than Standard for the same throughput. Justified only when you need VNet integration, customer-managed keys, 100MB messages, or predictable performance guarantees. Most workloads run fine on Standard.
Right-size Messaging Units on Premium
$722/month per MU removedEach MU = ~1,000 msg/sec capacity. Many teams default to 4-8 MUs without measuring. Monitor actual throughput; right-size MUs to peak load + 20% buffer.
FAQ
When should I use Service Bus vs Event Hubs vs Storage Queue?
Service Bus: enterprise messaging with transactions, sessions, FIFO, dead-letter. Event Hubs: high-throughput event ingestion (millions/sec), partitioning, stream processing. Storage Queue: simple, cheap, unordered. Service Bus for ordered/transactional async work; Event Hubs for telemetry/events; Storage Queue for simple async.
What counts as an 'operation'?
Send, Receive, Peek, Abandon, Complete, RenewLock — each is one operation. Batch operations count as one regardless of message count in the batch. Subscriptions: a send to a topic with 3 subscriptions = 1 send + 3 receives (if all 3 process).
How does Service Bus compare to AWS SQS?
Both managed messaging. SQS is cheaper for high-volume simple messaging ($0.40/M vs Service Bus Standard's $0.80/M after free tier). Service Bus has more enterprise features (sessions, transactions, scheduled delivery, AMQP). For Microsoft-stack apps, Service Bus integrates better.
Is Premium worth it for production?
Sometimes. Premium gives predictable performance (no noisy-neighbor), VNet integration, larger messages. For high-throughput production (millions of ops/day) the dedicated capacity is worth it. For moderate workloads, Standard's pay-per-op model is more economical.
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_servicebus_namespace.