CloudConsole

Lambda memory size: choosing the right setting

Updated 17 November 2026 · How we write and check guides

Short answer

Lambda memory can be set from 128 MB (the default) to 10,240 MB in 1 MB steps, and Lambda allocates CPU in proportion: at 1,769 MB a function has the equivalent of one full vCPU. Because cost is memory times duration, adding memory to a CPU- or network-bound function often makes it faster and no more expensive. Start around 512 to 1,024 MB for typical API handlers, then tune from measured Max Memory Used and duration rather than guessing.

Bar chart: Lambda memory sets the CPU too. 128 MB (default) 0.07 vCPU; 512 MB 0.29 vCPU; 1,024 MB 0.58 vCPU; 1,769 MB 1.00…
Where this setting acts, with the default and allowed values from this page.

How memory, CPU and price relate

  • Range: 128 MB to 10,240 MB for standard functions; default 128 MB.
  • CPU: proportional to memory, one vCPU-equivalent at 1,769 MB and proportionally more above that. Below 1,769 MB a single-threaded function gets a fraction of a core.
  • Network bandwidth per execution environment is 625 Mbps by default; for functions outside a VPC you can request an increase that then scales with memory, up to 3,000 Mbps at 10,240 MB.
  • Price is per GB-second: doubling memory doubles the per-millisecond price, so it pays for itself only if duration falls by about half or more.

128 MB is right only for very small functions that route events. Anything that imports large SDKs, parses JSON of any size, or calls other services usually runs much faster with more.

Recommended starting points

Function typeStart atWatch for
Event routing, small transforms128 to 256 MBDuration spikes when payloads grow
Typical API handler (Node.js, Python)512 to 1,024 MBCold start time, p99 duration
Java, .NET, or heavy frameworks1,024 to 2,048 MBInit duration; consider SnapStart for Java
CPU-bound (image processing, compression, crypto)1,769 MB or moreDuration falling as memory rises
Multi-threaded workloads3,538 MB+ (two or more vCPUs)Only helps if the code uses threads
Large in-memory datasetsPeak heap + 20 to 30%Max Memory Used close to the setting

Measure, then tune

Every invocation logs a REPORT line with Memory Size and Max Memory Used. Query them across many invocations:

filter @type = "REPORT"
| stats max(@maxMemoryUsed / 1000 / 1000) as maxUsedMB,
        avg(@duration) as avgMs, pct(@duration, 99) as p99Ms,
        max(@memorySize / 1000 / 1000) as configuredMB by bin(1h)

More on this in the memory usage query. Then try two or three settings under realistic load and compare cost per invocation (memory GB x duration seconds). The open-source AWS Lambda Power Tuning state machine automates this comparison, and AWS Compute Optimizer gives memory recommendations for functions with enough history.

Change it

aws lambda update-function-configuration --function-name image-resizer --memory-size 2048
aws lambda wait function-updated --function-name image-resizer
aws lambda get-function-configuration --function-name image-resizer --query '{memory:MemorySize,timeout:Timeout,tmp:EphemeralStorage.Size}'

Console: Configuration, General configuration, Edit, Memory. CloudFormation: MemorySize on AWS::Lambda::Function (SAM: MemorySize on the function or in Globals). Terraform: memory_size on aws_lambda_function.

Memory is separate from ephemeral storage (/tmp, 512 MB to 10,240 MB), which you set with --ephemeral-storage Size=.... If you publish versions, publish again so the alias uses the new setting.

Symptoms of a wrong setting

SymptomLikely cause
Max Memory Used equals Memory Size, then Runtime exited with error: signal: killedToo little memory; see out of memory
Long cold starts, slow first requestToo little CPU for initialisation; raise memory or trim dependencies
Duration falls little when memory doublesI/O-bound; you're paying for unused CPU, step back down
Timeouts under load at low memoryCPU starvation; more memory often fixes it before a longer timeout does

Questions

What is the default memory for a Lambda function?

128 MB. You can set any value from 128 MB to 10,240 MB in 1 MB increments.

How much CPU does Lambda give per memory setting?

CPU is allocated in proportion to memory; at 1,769 MB a function gets the equivalent of one vCPU.

Does increasing Lambda memory increase cost?

The price per millisecond rises with memory, but faster execution can offset it. For CPU-bound functions, more memory is often the same cost or cheaper overall.

When this happens away from your desk

Memory problems show up as timeouts and out-of-memory errors under load. CloudConsole, a phone app for AWS, is being built to show Lambda duration and error alarms with the REPORT lines behind them on your phone.

About the app → · Download on the App Store

Sources