Lambda Duration Calculator
Blend warm and cold invocations into an average billed duration, GB-seconds and timeout headroom for a Lambda function.
Inputs
Average Billed Duration
189ms
Cold-start Invocation Duration
630ms
Monthly GB-seconds
472,500GB-s
Monthly Compute Cost
$7.88
Timeout Headroom
89.5%
Timeout Assessment
Healthy margin above the slowest invocation
Step by step
Values used
Invocations per month = 5,000,000 requests; Memory configured = 512 MB; Warm invocation duration = 180 ms; Extra latency on a cold start = 450 ms; Share of invocations that cold start = 2 %; Configured timeout = 6 s; Price per GB-second = 0.0000 USD
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.
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
How it works
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
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.