The Wednesday Lambda Tune-Up: 6 Settings That Make Your Functions Faster and Cheaper
Your Lambda functions work. These six small settings make them work better, and most take under a minute to change.*
โก Wednesday, 4 PM: "Why Is It So Slow?"
Remember Priya, Arjun, and Meera, the three students who built StudyMate, their AI study buddy, on AWS?
Priya is demoing the quiz generator to their professor when the first request takes four whole seconds. The next one is fast. The one after that times out.
"It works on my laptop," she whispers.
Meera smiles. "Lambda isn't slow. We just never tuned it."
And that's how the Wednesday Tune-Up was born. Here's their checklist.
โจ The 6-Item Tune-Up Checklist
Nothing here is broken. These are defaults, which are designed to be safe for everyone, not perfect for you.
1. Right-Size Your Memory ๐ง
In Lambda, memory also controls CPU power. A function with more memory gets more CPU, so it often finishes sooner, and since you pay for memory ร duration, a bigger setting can sometimes cost the same or even less.
Tune-up tip: Don't guess. Run the open-source AWS Lambda Power Tuning tool and let it test your function at different memory sizes.
2. Try ARM (Graviton) ๐ช
Many functions run on ARM64 with no code changes, especially Python and Node.js ones. ARM is priced lower per GB-second than x86, and AWS reports better price-performance.
Tune-up tip: Switch the architecture to ย
arm64ย , run your tests, and compare. If you use native libraries, make sure they have ARM builds.3. Set a Sensible Timeout โฑ๏ธ
The default timeout is just 3 seconds, and the maximum is 15 minutes. Too short and good requests fail. Too long and a stuck function keeps billing.
Tune-up tip: Look at your real duration in CloudWatch, then set the timeout comfortably above it, not at the maximum.
4. Cap Runaway Concurrency ๐ฆ
Lambda scales automatically, which is great until a bug or a traffic spike scales your bill too.
Tune-up tip: Set reserved concurrency on functions that call a database or a paid API, so they can never overwhelm it. Pair it with a budget alert.
5. Catch Failures with a DLQ or Destination ๐ฌ
Asynchronous invocations are retried automatically (twice by default), and after that the event can disappear without you noticing.
Tune-up tip: Add an on-failure destination or a dead-letter queue (SQS or SNS), so failed events wait for you instead of vanishing.
6. Keep Runtimes Fresh ๐
Every runtime version eventually reaches end of support. Deprecated runtimes stop receiving security patches, and AWS eventually blocks updates to functions that use them.
Tune-up tip: Once a quarter, list your functions and upgrade any that use an old runtime. Check the Lambda runtimes page for current dates.
โฑ๏ธ The 10-Minute Routine
- List your functions and note runtime, memory, timeout, and architecture.
- Open CloudWatch metrics and compare duration and errors against your settings.
- Tune one function at a time: memory first, then timeout, then architecture.
- Test again, and keep the change only if it's better.
That's it. Ten minutes, one function, one cup of coffee.
๐ ๏ธ Bonus: A Read-Only Lambda Inventory Script
This script lists your functions across all regions with their key settings. It only reads and doesn't change anything, so it's safe to run anytime:
for region in $(aws ec2 describe-regions --query "Regions[].RegionName" --output text); do echo "=== $region ===" aws lambda list-functions --region "$region" \ --query "Functions[].[FunctionName,Runtime,MemorySize,Timeout,Architectures[0]]" \ --output textdoneColumns: name, runtime, memory (MB), timeout (seconds), architecture.
๐ฑ Make It Even Easier: Measure Before You Tune
The StudyMate team keeps a tiny note for each function: "before: 1,024 MB, 1.8 s average โ after: 512 MB on arm64, 1.2 s." It makes the wins visible, and it stops anyone from tuning by guesswork.
๐ The Takeaway
By 4:10 PM, the quiz generator answers in under a second, and Priya's professor is nodding.
Lambda's free tier includes 1 million requests and 400,000 GB-seconds per month, so a well-tuned function stretches it even further. A few small settings can turn "it works" into "it flies." โกโ
Pricing, limits, and defaults can change. Check the Lambda documentation and pricing page for current details.
What's your favorite Lambda tuning trick? Share it in the comments! ๐ฌ
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article