
Azure Functions is a flexible and cost-effective serverless solution for running your code in the cloud. This guide breaks down the differences between the two main plans: Consumption and Flex Consumption.
Consumption vs. Flex Consumption
Azure Functions comes in two pay as you go plans:
- Consumption plan: The original offering, priced based on function execution time and total number of executions.
- Flex Consumption plan: Azure’s newer offering with more flexibility and features, including “Always Ready” instances, memory configuration, and virtual network integration.
Overall, the Flex Consumption plan is slightly more expensive than the base Consumption Plan but offers more features and better functionality. Azure officially recommends this plan over the original Consumption plan.
Consumption plan pricing
Consumption plan Azure Functions are priced based on the following components (East US region):
- Execution Time: $0.000016 per GB-second (first 400,000 GB-s per month free)
- Total executions: $0.20 per million executions (first 1 million executions per month free)
The cost of the individual components are added together to get the total cost.
Instance sizes are non-configurable and limited to 1.5 GB.
Interestingly, this pricing model and rates are identical to AWS Lambda pricing.
Pricing example
Let’s say your function runs 3 million times per month for 1 second each time:
Calculation | Total | |
---|---|---|
Execution Time | 3 million executions x 1 second x 1.5 GB | 4,500,000 GB-s |
Billable Execution Time | 4,500,000 GB-s - 400,000 GB-s | 4,100,000 GB-s |
Execution Time Cost | 4,100,000 GB-s x $0.000016 | $65.60 |
Billable Executions | 3 million - 1 million | 2 million |
Executions Cost | 2 x $0.20 | $0.40 |
Total Cost | $65.50 + $0.40 | $66.00 |
Flex Consumption plan pricing
Like the base Consumption plan, Flex Consumption charges by Execution Time and Total Executions, but at higher base rates.
- Execution Time: $0.000026 per GB-second (first 100,000 GB-s per month free)
- Total Executions: $0.40 per million executions (first 1 million executions per month free)
If you use the Always Ready feature (pre-provisioned instances), the pricing is slightly different:
- Baseline: $0.000004 per GB-second (first 100,000 GB-s per month free)
- Execution Time: $0.000016 per GB-second
- Total Executions: $0.40 per million executions
You will be billed at the “Baseline” rate based on the memory you select, even for idle time.
Resource allocation
The default instance size is 2,048 MB (2 GiB). The other options are 512 MB and 4,096 MB.
Flex Consumption pricing example
Let’s say your function runs for 1 second with 2,048 MB of allocated memory 3 million times per month, but with Always Ready enabled. Note that with Always Ready enabled, there is no free grant.
Calculation | Total | |
---|---|---|
Baseline Time | 2,592,000 seconds (30 day month) x 2 GB | 5,184,000 GB-s |
Baseline Cost | 5,184,000 GB-s x $0.000004 | $20.74 |
Execution Time | 3 million executions x 1 second x 2 GB | 6,000,000 GB-s |
Execution Time Cost | 6,000,000 GB-s x $0.000016 | $96.00 |
Executions Cost | 3 x $0.40 | $1.20 |
Total Cost | $20.74 + $96.00 + $1.20 | $117.94 |