Skip to content
ENExplore Calculators

Lambda Duration Calculator

Blend warm and cold invocations into an average billed duration, GB-seconds and timeout headroom for a Lambda function.

About Lambda Duration Calculator

Lambda bills in 1 ms increments, so the average billed duration is the invocation-weighted blend of warm and cold executions rounded up. Init duration on a cold start is billed for SnapStart and provisioned concurrency but not for a standard on-demand invocation, which is why the blended figure is what your GB-second meter actually sees. Compute the cost with the GB-second rate for your region rather than assuming the default here is current. Duration is the one variable you can usually cut without changing anything else: halving it halves the compute half of the bill and, unlike memory, it also improves the latency your users feel.

Formula

Lambda Duration

billed duration = warm ms × (1 − cold rate) + (warm ms + cold-start ms) × cold rate, rounded up to the next millisecond; GB-seconds = memory GB × billed seconds × invocations.

warm ms
Duration of an invocation that reuses a live execution environment
cold rate
Fraction of invocations that pay the initialization penalty
timeout headroom
Spare time between the slowest invocation and the configured timeout

Worked example

With the default values below, Lambda Duration Calculator returns Average Billed Duration of 189. Change any input above and every figure here is recalculated in your browser.

Inputs used

Invocations per monthminimum 0 requests
5,000,000 requests
Memory configuredaccepts 128–10,240 MB
512 MB
Warm invocation durationaccepts 1–900,000 ms
180 ms
Extra latency on a cold startaccepts 0–20,000 ms
450 ms
Share of invocations that cold startaccepts 0–100 %
2 %
Configured timeoutaccepts 1–900 s
6 s
Price per GB-secondminimum 0 USD
0.000017 USD

Results

Average Billed Duration
189 ms
Cold-start Invocation Duration
630 ms
Monthly GB-seconds
472,500 GB-s
Monthly Compute Cost
$7.88
Timeout Headroom
89.5%
Timeout Assessment
Healthy margin above the slowest invocation

Step by step

  1. 1Values used
  2. 2Lambda Duration
  3. 3Average Billed Duration= 189 ms
  4. 4Cold-start Invocation Duration= 630 ms
  5. 5Monthly GB-seconds= 472,500 GB-s
  6. 6Monthly Compute Cost= 7.88
  7. 7Timeout Headroom= 89.5
  8. 8Timeout Assessment= Healthy margin above the slowest invocation

Assumptions and limits

  • The result is derived only from the 7 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to 2 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

How is Lambda Duration calculated?

billed duration = warm ms × (1 − cold rate) + (warm ms + cold-start ms) × cold rate, rounded up to the next millisecond; GB-seconds = memory GB × billed seconds × invocations. Lambda bills in 1 ms increments, so the average billed duration is the invocation-weighted blend of warm and cold executions rounded up. Init duration on a cold start is billed for SnapStart and provisioned concurrency but not for a standard on-demand invocation, which is why the blended figure is what your GB-second meter actually sees. Compute the cost with the GB-second rate for your region rather than assuming the default here is current.

Why does Lambda Duration matter?

Duration is the one variable you can usually cut without changing anything else: halving it halves the compute half of the bill and, unlike memory, it also improves the latency your users feel.

What values do I need to enter?

This calculator takes 7 inputs: Invocations per month, Memory configured, Warm invocation duration, Extra latency on a cold start, Share of invocations that cold start, Configured timeout, Price per GB-second. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.

Should the timeout be close to the average duration?

No. Set the timeout above your p99.9 cold-start duration but low enough that a hung downstream call fails fast instead of burning 15 minutes of GB-seconds. A timeout two to three times the cold-start duration is a common compromise.

Lambda Duration Calculator | Calcrivo