"Serverless is cheaper" is one of those lines that gets repeated until nobody checks it. For a cron job that runs twice a day, it's true. For a Django API with steady traffic, it's often false, sometimes by a wide margin, and the bill arrives after the architecture is already committed.
The position: Lambda is priced per unit of work, EC2 is priced per unit of time. Below a certain steady load, per-work wins. Above it, the boring box wins, and the crossover comes sooner than people expect. You can work out where yours is with a calculator and ten minutes. Most teams never do.
How Lambda actually bills
The pricing model is simple, which is exactly why it's easy to underestimate:
- A request charge per invocation.
- A duration charge in GB-seconds: allocated memory multiplied by the time your function runs, billed per millisecond.
- A free tier of 1 million requests and 400,000 GB-seconds per month.
- Since 1 August 2025, the INIT phase is billed for on-demand ZIP functions on managed runtimes too. Cold start time is now part of your bill, not just your latency.
- Extras around it: API Gateway or a function URL in front, CloudWatch Logs for every invocation, NAT gateway charges if your function sits in a VPC and calls the internet, and provisioned concurrency if you buy your way out of cold starts.
As of February 2026, the AWS pricing page lists x86 on-demand duration at $0.0000166667 per GB-second and requests at $0.20 per million, in its worked example. Prices vary by region and Arm (Graviton) is cheaper per GB-second, so check your own region before you plug in numbers.
The part everybody misses: you pay for waiting
A typical Django endpoint doesn't compute much. It receives a request, runs a few queries, maybe calls another service, serialises JSON. Most of its wall-clock time is spent waiting on I/O.
On an EC2 box, that waiting is nearly free. While one request waits on Postgres, the same process, through threads, async or more workers, serves others. One instance overlaps hundreds of waiting requests.
On default Lambda, each execution environment handles one request at a time, and you're billed for its full duration, waiting included. A 200 ms request that spends 180 ms waiting on the database costs you 200 ms of allocated memory. Lambda bills you for the time your code is idle.
That's the structural reason I/O-heavy, steady-traffic APIs tend to be expensive on Lambda. It's not a pricing trick. It's the model.
The formula
Per month, ignoring the free tier:
lambda_cost = R * (P_req + d * m * P_gbs)
R = requests per month
P_req = price per request (e.g. 0.20 / 1,000,000)
d = average billed duration, s (include INIT for cold starts)
m = allocated memory, GB
P_gbs = price per GB-second (e.g. 0.0000166667)
The cost per request is the bracket. Break-even against a fixed monthly server cost E is simply:
break_even_requests = E / (P_req + d * m * P_gbs)
As code, so you can play with it:
SECONDS_PER_MONTH = 30 * 24 * 3600
def lambda_monthly(rps: float, duration_s: float, memory_gb: float,
p_req: float = 0.20 / 1_000_000,
p_gbs: float = 0.0000166667) -> float:
requests = rps * SECONDS_PER_MONTH
return requests * (p_req + duration_s * memory_gb * p_gbs)
def break_even_rps(server_monthly: float, duration_s: float, memory_gb: float,
p_req: float = 0.20 / 1_000_000,
p_gbs: float = 0.0000166667) -> float:
per_request = p_req + duration_s * memory_gb * p_gbs
return server_monthly / per_request / SECONDS_PER_MONTH
print(round(lambda_monthly(50, 0.2, 1.0), 2)) # 457.92
print(round(break_even_rps(150, 0.2, 1.0), 1)) # 16.4
A worked example (illustrative numbers)
These are made-up but realistic inputs, not a benchmark. Change them to yours.
- An API averaging 50 requests per second, all month.
- 200 ms average duration, 1 GB of memory.
- That's about 129.6 million requests a month.
Lambda, before the free tier, API Gateway, logs or NAT:
- Requests: 129.6M x $0.20 per million = about $26
- Duration: 129.6M x 0.2 s x 1 GB = 25.9M GB-s, x $0.0000166667 = about $432
- Total: about $458 a month, and that's before the extras.
Now suppose your alternative, a pair of modest instances behind a load balancer for redundancy, costs $150 a month (an illustrative figure, not a quote; price your own instance types). The break-even is about 16 requests per second of average load. Above that, every extra request widens the gap in the box's favour, because the box costs the same whether it's 20% or 70% busy.
Notice what moves the answer most: duration and memory. Halve your average duration and Lambda's duration bill halves. Teams that cut Lambda bills mostly do it by making functions faster or smaller, which is a fine outcome. But it's the same work that makes a box handle more load.
Cold starts are a cost, not just a delay
Django is not a small import. Load settings, the ORM, apps, DRF, a few SDKs, and the init phase can take a noticeable fraction of a second. Since INIT is billed, every cold start is paid time. The options all cost something:
- Provisioned concurrency keeps environments warm, and you pay for it by the hour whether requests arrive or not. Which is, functionally, a server.
- SnapStart for Python restores from a snapshot to cut init time, with its own charges and caveats around anything that must be unique per environment, like random seeds and connections.
- Slimming the package and lazy imports help, and they're worth doing anyway.
And then there's the database. Hundreds of concurrent Lambda environments each opening a Postgres connection will exhaust max_connections quickly. The fix is RDS Proxy or another pooler, which is another line on the bill and another moving part.
Where Lambda genuinely wins
I'm not anti-Lambda. I'm anti-assuming. It's excellent when:
- Traffic is spiky or near zero most of the time. Internal tools, webhooks, a back-office API used during business hours. Scale to zero is real money.
- It's event glue. S3 upload triggers, SQS consumers, EventBridge rules, small transforms between AWS services. This is what Lambda was built for and it's hard to beat.
- Scheduled jobs. A nightly report doesn't justify an always-on box.
- Parallel bursts. Fan out thousands of independent tasks for five minutes, then nothing.
- You have no one to run servers. Patching, scaling and replacing instances is real work. If nobody on the team will do it, that labour has a cost too, and it can outweigh the bill difference. Just count it honestly rather than assuming it's huge.
Note the shape: Lambda wins when utilisation would be low on a server. The less steady the traffic, the better it looks.
The boring middle ground
It isn't Lambda or a hand-built pet server. A Django app in a container on ECS with Fargate, or an EC2 Auto Scaling group behind a load balancer, gives you managed deploys, health checks and scaling while keeping the concurrency model where one process serves many waiting requests. Add a Compute Savings Plan or reserved capacity for the baseline and your steady load gets cheaper still. AWS itself launched Lambda Managed Instances in late 2025: functions run on EC2 instances, several requests share an execution environment, and you pay EC2 instance prices plus a management fee and the usual request charge, instead of per-request duration. When the vendor ships that hybrid for steady workloads, the trade-off is real.
How to decide
- Pull a month of real traffic. Get average requests per second and the peak-to-average ratio.
- Measure average billed duration and memory from your Lambda
REPORTlog lines, or estimate from your current app's response times. - Run the formula. Add API Gateway, logs, NAT and any provisioned concurrency.
- Price the boring alternative honestly, including redundancy and a bit of headroom.
- If Lambda is cheaper, or close and the ops savings matter, use it. If it's several times more, stop calling it the cheap option.
Bottom line
Lambda bills you for every millisecond your code waits on a database. That's perfect for bursty, event-driven and low-traffic work, and expensive for steady APIs. Do the arithmetic before the architecture diagram. The boring EC2 box doesn't have a conference talk, but it often has the smaller invoice.