azurerm_iothub cost estimation
A managed IoT message broker billed per provisioned unit by tier. An S1 unit is $25/month and includes a daily message quota; you scale by adding units.
An azurerm_iothub is the managed gateway for device-to-cloud and cloud-to-device messaging. Cost is a flat monthly fee per provisioned unit, set by tier — you don't pay per message directly; you pay for units that each include a daily message quota.
The tiers ladder by quota and price: S1 is $25/unit/month (400K messages/day per unit), S2 is $250/unit (6M/day), S3 is $2,500/unit (300M/day). The Basic tier (B1/B2/B3) mirrors the prices with reduced features (no cloud-to-device, no device twins). The Free tier (F1) is $0 with a tiny quota for testing.
You scale capacity by adding units of a tier (sku_capacity), and the bill is units × the tier rate. The cost decisions are which tier matches your message volume and feature needs, and how many units. Over-provisioning units, or sitting on S2/S3 when message volume fits S1, are the common overspends.
c3x prices the hub from sku_name and sku_capacity, so the monthly cost is visible before deployment.
Terraform example
A minimal but realistic configuration that C3X can estimate.
resource "azurerm_iothub" "devices" {
name = "device-hub"
resource_group_name = azurerm_resource_group.main.name
location = azurerm_resource_group.main.location
sku {
name = "S1"
capacity = 1
}
}Pricing dimensions
What you actually pay for when you provision azurerm_iothub.
| Dimension | Unit | What's being charged |
|---|---|---|
| IoT Hub unit | per unit-month | Flat monthly fee per provisioned unit by tier, each including a daily message quota. Scale by adding units (sku_capacity). $25/unit for S1 (400K msg/day); S2 $250, S3 $2,500 |
Sample C3X output
A single S1 unit:
azurerm_iothub.devices
└─ IoT Hub unit (S1 × 1) 1 unit-month $25.00
Monthly $25.00Optimization tips
Common ways to reduce azurerm_iothub cost without changing the workload.
Match the tier to message volume
Difference between tier choicesTiers are quota-based: S1 covers 400K messages/day per unit. Two S1 units (800K/day, $50) can be cheaper than one S2 ($250) if your volume fits — and vice versa at higher scale. Map your daily message volume to the cheapest tier+unit combination.
Right-size unit count
$25+/month per removed S1 unitEach unit adds quota and cost. Provision units to actual daily message volume with headroom, not peak-of-peaks. Monitor the quota-used metric and scale units to it.
Use the Basic tier if you don't need advanced features
Feature-dependentBasic (B1/B2/B3) costs the same per unit as Standard but is cheaper to operate when you only need device-to-cloud telemetry — it drops cloud-to-device messaging and device twins. Use it where those features aren't required.
Don't size for message-batching inefficiency
Per quota tier avoidedIoT Hub counts messages in 4 KB blocks. Batching small device messages into fewer, fuller messages reduces billed message count, letting you stay on a smaller tier/unit count.
FAQ
How is Azure IoT Hub billed?
Per provisioned unit by tier, as a flat monthly fee — not per message. An S1 unit is $25/month and includes 400K messages/day; you scale by adding units. S2 ($250) and S3 ($2,500) units carry larger daily quotas.
How do I choose the right IoT Hub tier?
By daily message volume and features. Map your messages/day to the cheapest combination of tier and unit count — sometimes multiple S1 units beat one S2, sometimes not. Use Basic if you only need device-to-cloud telemetry.
How does c3x estimate the cost?
From sku_name and sku_capacity, pricing units × the tier rate, so an over-provisioned unit count or oversized tier shows its monthly cost before deployment.
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_iothub.