azurerm_lb_rule cost estimation
A load-balancing rule that maps a frontend port to a backend pool. The rule is free to define. Cost lives on the parent Standard Load Balancer: a base rule charge, per-rule overage, data processed, and the public IP.
The azurerm_lb_rule resource defines how traffic arriving on a frontend IP and port is distributed to a backend pool. Writing the rule in Terraform costs nothing on its own, but on a Standard Load Balancer the number of rules is exactly what the base charge is calculated from, so rules are the metering unit even though the resource is free.
A Standard Load Balancer bills a base charge of about $0.025/hour (roughly $18/month) that covers the first five rules, where load-balancing rules, inbound NAT rules, and outbound rules all count toward that five. Each rule beyond the fifth adds about $0.01/hour (roughly $7.30/month). On top of the rule-based charge, the Standard SKU bills data processed at about $0.005/GB for all inbound and outbound traffic through the load balancer. The frontend also needs a Standard public IP, which is a static address billed at about $0.005/hour (roughly $3.65/month).
The Basic Load Balancer, which was free and had no data-processing charge, has been retired, so new deployments land on Standard and inherit these charges. That makes the count of rules a real cost lever: a load balancer carrying twelve rules pays the base charge plus seven rule overages, which adds up meaningfully at scale across many load balancers.
The cost-adjacent gotcha is the data-processing charge on high-throughput services. A load balancer fronting a chatty internal service or a large data transfer can move tens of terabytes a month, and at $0.005/GB that data-processing line can dwarf the rule charges. It is easy to focus on the small hourly rule fee and miss that traffic volume is the larger number.
c3x flags azurerm_lb_rule as free and attributes the base rule charge, per-rule overage, data processing, and public IP cost to the parent Standard Load Balancer.
Terraform example
A minimal but realistic configuration that C3X can estimate.
resource "azurerm_public_ip" "lb" {
name = "lb-frontend-ip"
location = "eastus"
resource_group_name = azurerm_resource_group.main.name
allocation_method = "Static"
sku = "Standard"
}
resource "azurerm_lb" "main" {
name = "app-lb"
location = "eastus"
resource_group_name = azurerm_resource_group.main.name
sku = "Standard"
frontend_ip_configuration {
name = "frontend"
public_ip_address_id = azurerm_public_ip.lb.id
}
}
resource "azurerm_lb_backend_address_pool" "main" {
loadbalancer_id = azurerm_lb.main.id
name = "backend-pool"
}
resource "azurerm_lb_rule" "https" {
loadbalancer_id = azurerm_lb.main.id
name = "https"
protocol = "Tcp"
frontend_port = 443
backend_port = 443
frontend_ip_configuration_name = "frontend"
backend_address_pool_ids = [azurerm_lb_backend_address_pool.main.id]
}Pricing dimensions
What you actually pay for when you provision azurerm_lb_rule.
| Dimension | Unit | What's being charged |
|---|---|---|
| Load balancing rule | free | Defining the rule carries no per-resource charge, but rules are what the base charge is counted from. $0 (free) |
| Standard LB base (first 5 rules) | per hour | Covers the first five rules on a Standard Load Balancer, counting load-balancing, NAT, and outbound rules together. about $0.025/hour (about $18/month) |
| Additional rule (beyond 5) | per hour | Each rule past the fifth adds to the hourly charge. about $0.01/hour per rule (about $7.30/month) |
| Data processed | per GB | All inbound and outbound traffic through a Standard Load Balancer. about $0.005/GB |
| Standard public IP | per hour | The static frontend IP address the load balancer listens on. about $0.005/hour (about $3.65/month) |
Optimization tips
Common ways to reduce azurerm_lb_rule cost without changing the workload.
Keep rule count at or under five where possible
$7.30/month per avoided ruleThe base charge covers five rules. Load-balancing, inbound NAT, and outbound rules all count. Consolidating or removing unused rules keeps you inside the base charge and avoids the per-rule overage.
Watch data processed on high-throughput load balancers
At $0.005/GB, a load balancer moving tens of terabytes a month bills more for data than for rules. For east-west traffic that does not need load balancing, consider direct connectivity or a service that does not meter data.
Release orphaned Standard public IPs
$3.65/month per orphaned IPA Standard static public IP bills whether or not it is attached. When you delete a load balancer, delete its frontend IP too, and audit for detached addresses.
Prefer outbound rules over per-instance public IPs
A single outbound rule on the load balancer provides SNAT for the whole backend pool, avoiding a separate public IP on each VM. Fewer public IPs means less standing IP cost.
FAQ
Does a load balancer rule cost anything by itself?
No. The rule is free to define, but on a Standard Load Balancer the number of rules determines the base charge. The first five rules are covered by the base fee, and each rule beyond that adds to the hourly cost.
What counts toward the five included rules?
Load-balancing rules, inbound NAT rules, and outbound rules all count together. If you have three load-balancing rules and three NAT rules, you have six and pay one rule overage.
Is there still a free Load Balancer option?
No. The Basic Load Balancer, which was free and did not charge for data processing, has been retired. New deployments use the Standard SKU, which bills the base rule charge, per-rule overage, data processed, and a Standard public IP.
What usually drives the Load Balancer bill up?
Two things: too many rules pushing past the included five, and data processed on high-throughput services. At $0.005/GB, traffic volume is frequently the larger of the two and the one people overlook.
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_lb_rule.