Revenue Rex logo mark
💰 Financial · Rex's Toolbox

Serverless / Lambda Cost Calculator

Turn invocation count, duration, and memory into a monthly bill.

Revenue Rex peeking

Rex says

Money math without the spreadsheet headache. Plug in your numbers and I'll show you exactly where the dollars land.

Try a scenario

Click to load — tweak from there.

Inputs

Result

Monthly serverless cost

$4.55

Compute (GB-second) cost

$3.75

Invocation fee cost

$0.80

Total GB-seconds used

625,000

Cost per million invocations

$0.91

Revenue Rex peeking

Psst — share this and help Rex grow

One click, a permanent link with your numbers baked in.

More financial

How to use this

  1. 1Enter invocations per month.
  2. 2Enter average duration (ms).
  3. 3Enter memory allocated (MB).
  4. 4Enter price per million invocations ($).
  5. 5Enter price per gb-second ($).
  6. 6Enter free gb-seconds per month.
  7. 7Read your monthly serverless cost on the right — it updates as you type.
  8. 8Hit Share to keep the scenario or send it to someone.

About this calculator

Serverless platforms like AWS Lambda, Google Cloud Functions, and Azure Functions bill on two axes: a per-invocation fee and a compute charge based on memory allocated multiplied by execution duration, measured in GB-seconds. This calculator applies both, including the typical free tier of 1 million requests and 400,000 GB-seconds per month that AWS offers, so small workloads often show as effectively free while high-volume workloads reveal their real cost. Memory allocation matters more than people expect — doubling memory doubles the GB-seconds rate but can also make the function run faster due to proportional CPU allocation, so the net cost change is not always what it looks like at first. This tool assumes a fixed duration input; if you're deciding between memory tiers, run it twice with the duration you measure at each memory setting to find the actual cheapest configuration, which is often not the smallest memory size.

FormulaGB-seconds = (memory MB ÷ 1024) × duration(s) × invocations; cost = invocation fee + GB-seconds × rate, minus free tier.

Worked example

Using the values the calculator loads with:

Inputs

  • Invocations per month: 5000000
  • Average duration: 250 ms
  • Memory allocated: 512 MB
  • Price per million invocations: 0.2 $
  • Price per GB-second: 0.0000166667 $
  • Free GB-seconds per month: 400000

Results

  • Monthly serverless cost: $4.55
  • Compute (GB-second) cost: $3.75
  • Invocation fee cost: $0.80
  • Total GB-seconds used: 625,000
  • Cost per million invocations: $0.91

What each field means

Inputs

Invocations per month
The invocations per month used in the calculation. Starts at 5000000 so you have a working example on load.
Average duration (ms)
The average duration used in the calculation, measured in ms. Starts at 250 ms so you have a working example on load.
Memory allocated (MB)
The memory allocated used in the calculation, measured in MB. Starts at 512 MB so you have a working example on load.
Price per million invocations ($)
The price per million invocations used in the calculation, measured in $. Starts at 0.2 $ so you have a working example on load.
Price per GB-second ($)
The price per gb-second used in the calculation, measured in $. Starts at 0.0000166667 $ so you have a working example on load.
Free GB-seconds per month
The free gb-seconds per month used in the calculation. Starts at 400000 so you have a working example on load.

Results

Monthly serverless cost
Returned as a money amount in US dollars and shown as the headline result. It recalculates instantly whenever you change an input, so you can compare scenarios without reloading.
Compute (GB-second) cost
Returned as a money amount in US dollars. It recalculates instantly whenever you change an input, so you can compare scenarios without reloading.
Invocation fee cost
Returned as a money amount in US dollars. It recalculates instantly whenever you change an input, so you can compare scenarios without reloading.
Total GB-seconds used
Returned as a whole number. It recalculates instantly whenever you change an input, so you can compare scenarios without reloading.
Cost per million invocations
Returned as a money amount in US dollars. It recalculates instantly whenever you change an input, so you can compare scenarios without reloading.

FAQ

At what volume does serverless get more expensive than a VM?

As a rough rule, once a function runs close to continuously — meaning invocations × duration approaches 730 hours of compute time per month — a reserved VM or container running the same workload is typically 3-8x cheaper per unit of compute. Serverless wins on spiky, low-average-utilization workloads where you'd otherwise pay for idle VM time.

Why would increasing memory ever lower total cost?

Lambda allocates CPU proportionally to memory. A function bottlenecked on CPU (not I/O) can run 2-4x faster with 2x the memory, so GB-seconds (memory × time) can actually drop even though the rate per GB-second stays the same, because the time term fell faster than the memory term rose. Always benchmark actual duration at each memory tier before assuming smaller is cheaper.

Does cold start time count toward billed duration?

Yes for most providers — AWS Lambda bills from the start of code execution including initialization on a cold start, though the very first init phase for some runtimes is billed separately or capped. Cold starts add 100ms-2s depending on runtime and package size, which matters for latency but is usually a small fraction of total monthly GB-seconds unless invocations are very short and frequent.

Accuracy and limitations

  • Results are estimates before tax, fees, and inflation unless an input explicitly covers them.
  • Rates are treated as fixed for the whole period — variable-rate products will drift from this projection.
  • This is educational maths, not financial advice. Check anything contractual with the lender or your accountant.

Related tools

Cite this calculator

Writing about this topic? Grab a citation — every link helps keep these tools free.

APA
RevenueLab. (2026). Serverless Function Invocation Cost Calculator. Retrieved from https://www.revenuelab.fyi/toolbox/serverless-invocation-cost
HTML
<p>Source: <a href="https://www.revenuelab.fyi/toolbox/serverless-invocation-cost" target="_blank" rel="noopener">Serverless Function Invocation Cost Calculator — RevenueLab</a> (2026).</p>
Markdown
Source: [Serverless Function Invocation Cost Calculator — RevenueLab](https://www.revenuelab.fyi/toolbox/serverless-invocation-cost) (2026).
Advertisement