azurerm_ linux_ function_ app cost estimation
A serverless function app. Three hosting plans with different cost models: Consumption (per-execution), Premium (always-warm), or App Service Plan (fixed).
An azurerm_
Consumption plan (Y1 SKU): the true serverless tier. Bills per execution and per GB-second of compute time, just like AWS Lambda. - $0.20 per million executions (first 1M/month free) - $0.000016/GB-second of execution time (first 400,000 GB-seconds/month free) - Scales to zero between invocations - Cold starts up to a few seconds
Premium plan (EP1, EP2, EP3 SKUs): always-warm workers with pre-warmed instances. - Per-vCPU-hour and per-GB-RAM-hour, like Premium App Service plans - EP1 starts at ~$0.205/hour (~$150/month) for one always-on worker - No cold starts, supports VNet integration
Dedicated App Service Plan: function app shares a plan with web apps. Same per-hour rates as Standard or Premium App Service plans. Right when you have web apps and want to consolidate.
For most workloads, Consumption is right. The free tier alone covers a lot of usage: 1M executions and 400,000 GB-seconds per month, free across all functions in the subscription.
Triggers other than HTTP add charges through their respective resources (Service Bus, Event Hubs, Storage Queue, etc.).
c3x reads the linked service_
Terraform example
A minimal but realistic configuration that C3X can estimate.
resource "azurerm_service_plan" "consumption" {
name = "function-consumption"
resource_group_name = azurerm_resource_group.main.name
location = azurerm_resource_group.main.location
os_type = "Linux"
sku_name = "Y1"
}
resource "azurerm_linux_function_app" "processor" {
name = "image-processor"
resource_group_name = azurerm_resource_group.main.name
location = azurerm_resource_group.main.location
service_plan_id = azurerm_service_plan.consumption.id
storage_account_name = azurerm_storage_account.functions.name
storage_account_access_key = azurerm_storage_account.functions.primary_access_key
site_config {
application_stack {
python_version = "3.11"
}
}
}Pricing dimensions
What you actually pay for when you provision azurerm_.
| Dimension | Unit | What's being charged |
|---|---|---|
| Consumption executions | per 1M executions | Each function invocation. First 1M/month free at subscription level. $0.20/1M executions |
| Consumption GB-seconds | per GB-second | Memory used × execution duration. First 400,000 GB-seconds/month free. $0.000016/GB-second |
| Premium plan | per worker per hour | Pre-warmed workers with VNet support. Charges continuously regardless of traffic. $0.205/hour for EP1 in eastus |
| Dedicated App Service Plan | per plan per hour | Shares the App Service Plan's rate. Right when consolidating function and web apps. |
Optimization tips
Common ways to reduce azurerm_ cost without changing the workload.
Use Consumption plan for variable or low workloads
Up to 100% during idleConsumption scales to zero between invocations. For functions with <1M executions/month or sporadic load, Consumption is dramatically cheaper than Premium.
Right-size function memory
Workload-dependentAzure Functions runtime allocates memory per function. Profile your function and don't request more memory than needed. Memory directly drives the GB-second cost.
Use Durable Functions for long-running workflows
Workload-dependentPlain functions on Consumption have a 10-minute timeout. Durable Functions checkpoint state and let workflows run effectively unbounded while charging only for active execution time.
Move from Premium to Consumption if cold starts are tolerable
$150/month per Premium plan eliminatedPremium plan is ~$150/month minimum for the always-on worker. If your function tolerates 1-3 second cold starts, Consumption can save the entire Premium minimum.
FAQ
Consumption or Premium plan?
Consumption: variable or low traffic, cold starts OK, no VNet needed. Premium: predictable high-traffic, cold starts unacceptable, or VNet integration required. Crossover is around several hundred thousand executions per day at moderate duration.
How does c3x estimate Consumption cost?
Requires monthly_
What's the difference vs aws_ lambda_ function?
Almost identical pricing model. Azure Functions Consumption is slightly cheaper per GB-second ($0.000016 vs Lambda's $0.0000167) but has higher cold start times. Lambda has more mature integrations with AWS services; Functions has tighter integration with Azure services.
Does the linked Storage Account cost extra?
Yes. Function apps require an Azure Storage Account for triggers and state. The storage account is billed separately on aws_
Related resources
More Azure resources
Further reading
- Azure Functions cost: Consumption vs Premium plan
Consumption bills per execution and scales to zero; Premium bills ~$150/month per always-on instance for no cold starts and VNet. Here's the crossover and the min-instances trap.
- Azure Logic Apps cost: Consumption per action vs Standard hosting
Logic Apps has two models: Consumption bills per action execution and connector call (scales to zero), while Standard runs on a hosting plan billed for allocated compute. Match the model to workflow volume. Here is the comparison.
- Serverless functions cost compared: Lambda vs Azure Functions vs Cloud Functions
AWS Lambda, Azure Functions, and Google Cloud Functions all bill invocations plus compute (memory times duration), with a free tier. The models are close; the real cost differences come from configuration and the surrounding services. Here is the comparison.
- Cold start mitigation cost: paying to keep functions warm
Serverless cold starts add latency; mitigating them with provisioned concurrency or minimum instances means paying for warm capacity around the clock. Whether that trade is worth it depends on traffic and latency needs. Here is the cost math.
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_.