Skip to content
All tools

Calculator

Lambda memory and cost

Enter one measured run of your AWS Lambda function and see how duration and cost change across memory sizes, from 128 MB to 10 GB.

Your function today

128 to 10,240

MB

Billed duration at that memory

ms

Used for the monthly total

/month

Sets the price per GB-second

Workload

The rest is waiting on I/O

%

1 for single-threaded code

Above the cheapest setting

%

Sweet spot

Set memory to 1,769 MB

13.8x faster than 128 MB, and it costs the same.

Now · 128 MB
19.3 s
$40.31 / month
Sweet spot · 1,769 MB
1,394 ms
$40.34 / month
Now Sweet spot
DurationCost per 1M invocations0 ms$0.009,628 ms$116.2719.3 s$232.53128 MB512 MB1 GB2 GB4 GB10 GB

Common memory sizes

MemoryDurationPer 1MMonthly
128 MBnow19.3 s$40.31$40.31
256 MB9,628 ms$40.32$40.32
512 MB4,814 ms$40.32$40.32
1,024 MB2,407 ms$40.32$40.32
1,769 MBsweet spot1,394 ms$40.34$40.34
2,048 MB1,394 ms$46.67$46.67
3,008 MB1,394 ms$68.45$68.45
4,096 MB1,394 ms$93.13$93.13
6,144 MB1,394 ms$139.60$139.60
8,192 MB1,394 ms$186.07$186.07
10,240 MB1,394 ms$232.53$232.53
Sweet spot1,769 MB · 13.8x faster

How this is calculated

Lambda doesn't let you pick CPU. It gives your function CPU in proportion to memory, reaching one full vCPU at 1,769 MB and up to six at 10,240 MB. The calculator splits your measured duration into time spent computing, which speeds up as CPU grows, and time spent waiting on I/O, which doesn't change. Computing time stops improving once the function has as many vCPUs as it has threads, so extra memory beyond that only adds cost.

Cost is billed duration (rounded up to the millisecond) × memory in GB × the price per GB-second, plus $0.20 per million requests. Prices are the on-demand rates in us-east-1 and eu-central-1: $0.0000166667 per GB-second for x86 and $0.0000133334 for Arm. The sweet spot is the fastest setting that costs no more than your chosen percentage above the cheapest one.

With the defaults from the article, the model predicts 2,407 ms at 1,024 MB against the 2,281 ms measured, and 1,394 ms at 10,240 MB against 1,262 ms. Close enough to choose a setting, not close enough to skip measuring it.

What it leaves out

  • Cold starts: only the duration of a warm invocation is modelled.
  • The free tier, volume discounts above 6 billion GB-seconds a month, and Compute Savings Plans.
  • Speed differences between x86 and Arm: switching architecture changes the price, not the duration.
  • Functions that genuinely need the memory, for example to hold a large file or model.

For a measured answer on your real workload, runAWS Lambda Power Tuning, which invokes your function at each memory size and charts the results.