AWS Lambda Costs Explained: Where the Bill Really Comes From

Your Lambda Bill Isn't Just Invocations: 6 Ways to Cut AWS Serverless Costs

Published by Rushikesh Dhule, LessBill · November 13, 2026 · Updated November 16, 2026

Serverless was sold as "pay only for what you use." That part is true. The catch is that most teams have no idea what they are actually using. The per-request price looks tiny, so nobody watches it, and then one month the Lambda line on the AWS bill is bigger than the EC2 line it was supposed to replace.

The good news: Lambda costs are some of the easiest cloud costs to cut, because the knobs are few and well understood. Here are six that matter most.

First, know what you are paying for

A Lambda bill has two main parts: a small fee per request, and a compute fee measured in GB-seconds (memory you allocate multiplied by how long the function runs). For most real workloads, the compute part is the big one. Around it sit the costs people forget: CloudWatch Logs, API Gateway, NAT Gateway traffic, and data moving between services.

One change makes this more important now. Since August 2025, AWS bills the INIT phase (the cold start, when your code and dependencies load) for standard on-demand functions packaged as ZIP files. Before that, init time for these functions was effectively free. Heavy packages and slow startup code now show up directly on your invoice.

1. Right-size memory with data, not guesses

Memory is the main lever, and it also sets how much CPU your function gets. Too little memory makes a function run longer, which can cost more. Too much means you pay for headroom you never touch. Most teams pick 512 MB or 1 GB once and never look again.

Fix: Run the open-source AWS Lambda Power Tuning tool on your top 10 functions by spend. It tests each one at several memory sizes and shows the cheapest and fastest settings. Also check AWS Compute Optimizer, which gives Lambda memory recommendations for free.

2. Move functions to Arm (Graviton)

Lambda on Arm costs about 20% less per GB-second than x86, and AWS says it can deliver up to 34% better price-performance. For most Python, Node.js and Java functions, switching is a one-line change.

Fix: Set the architecture to arm64, rebuild any native dependencies, and run your tests. Start with functions that have no compiled libraries. They usually just work.

3. Shrink cold starts now that they cost money

With INIT billed, a function that loads a 200 MB package and opens five SDK clients on every cold start pays for that work again and again.

Fix:

  • Remove unused dependencies and bundle only what each function needs.
  • Import SDK clients lazily, inside the code paths that use them.
  • Reuse connections across invocations by creating them outside the handler.
  • Check the "Init Duration" field in your REPORT log lines to find the worst offenders.

4. Stop paying for waiting

Lambda bills while your function is idle and waiting on a slow API, a database query or another service. A function that spends 3 seconds waiting for a third-party API is billed for all 3 seconds.

Fix: Set timeouts close to real run times (many teams raise them to the 15-minute maximum "just in case"). For long waits or multi-step jobs, use Step Functions or an event-driven pattern so you are not paying a function to sit there. Batch SQS and Kinesis records instead of processing them one at a time.

5. Watch the costs next to Lambda

The function itself is often not the biggest line. Chatty logging can make CloudWatch Logs cost more than the compute. Functions in a VPC that call the internet through a NAT Gateway pay data processing fees on every gigabyte.

Fix: Set log retention on every Lambda log group (the default is "never expire"), drop debug logs in production, and use VPC endpoints for S3 and DynamoDB traffic. Consider HTTP APIs instead of REST APIs in API Gateway when you do not need the extra features; they cost less per request.

6. Know when Lambda stops being the cheap option

Lambda is great for spiky, unpredictable traffic. For steady, high-volume work running all day, a container on Fargate or a small Arm instance is often cheaper. Compute Savings Plans also cover Lambda, which helps if your baseline is stable.

Fix: For each high-spend function, compare its monthly cost with the price of an always-on container that could handle the same load. If Lambda costs 2-3x more for a flat traffic pattern, it is time to move it.

Worked example: one function, two memory settings

A function runs 5 million times a month, averages 800 ms and is set to 1,024 MB on x86. AWS charges $0.20 per million requests and $0.0000166667 per GB-second on x86 in US East.

  • Requests: 5 x $0.20 = $1.00
  • Compute: 5,000,000 x 0.8 s x 1 GB = 4,000,000 GB-seconds x $0.0000166667 = $66.67

So almost the whole bill is duration multiplied by memory, not the invocation count. (The monthly free tier of 1 million requests and 400,000 GB-seconds takes about $6.87 off.)

Suppose testing shows the same function takes 900 ms at 512 MB. Compute becomes 5,000,000 x 0.9 s x 0.5 GB = 2,250,000 GB-seconds = $37.50, about 44% less, for a function that is 100 ms slower.

It can go the other way: CPU-heavy code often gets faster with more memory, and can end up cheaper at a higher setting. Do not guess. Run AWS Lambda Power Tuning, which tests your function at several memory sizes and reports cost and speed for each. Switching the architecture to Arm is a separate, small change described in the Lambda architecture docs.

Related guides: CloudWatch Logs Costs: How to Shrink an Observability Bill and Moving from x86 to Arm in the Cloud: A Step-by-Step Cost Guide.

The bottom line

Serverless is not automatically cheap. It is cheap when you right-size memory, run on Arm, keep cold starts lean, and do not pay functions to wait. Start with your top 10 functions by cost. That is usually where 80% of the savings are hiding, and most fixes take an afternoon.

How LessBill can help

LessBill.org watches your AWS, GCP and Azure spend in one place, flags functions and services whose costs are climbing, and points you to the fixes worth doing first, so serverless stays as cheap as it was promised to be.

Sources and further reading

Also drawn on: AWS Compute Blog, AWS News Blog, AWS Lambda pricing documentation, CloudZero, Holori.

Comments

Popular posts from this blog

Stop Paying On-Demand Prices: Savings Plans, Reserved Instances and Spot Explained

7 Zombie Cloud Resources Quietly Draining Your Bill (and How to Kill Them)

When Does Azure SQL Serverless Beat Provisioned? The Maths