Posted on Mar 22, 2026 · Updated Mar 22, 2026 · 12 min read
Serverless Costs: Lambda, Functions, Cloud Run Pricing (2026)
Serverless promises zero idle costs — you pay only when code runs. That promise holds at low traffic. It breaks at scale. The crossover point between serverless and containers sits around 1 million requests per day for most workloads, but the exact number depends on function duration, memory allocation, and which invisible line items you're counting. Most teams don't count them all.
This post covers how serverless pricing actually works across AWS Lambda, Azure Functions, and Google Cloud Run — the published rates, the hidden adders, the scale at which containers win, and how to optimize each. All figures are 2026 list prices unless noted. Use our serverless cost calculator to run the numbers for your specific workload.
TL;DR
Lambda costs $0.20/1M requests + $0.0000166667/GB-second. At low volume (under ~1M req/day), serverless is almost always cheaper than equivalent containers. Above that threshold, a single always-on container instance typically beats per-invocation pricing. Hidden costs — API Gateway ($3.50/1M calls), CloudWatch Logs ($0.50/GB ingested), and cold-start-induced retries — add 30–60% to the raw compute number. Azure Functions and Cloud Run price similarly with meaningful differences in free tiers and minimum billing increments.
Table of contents
How serverless pricing works
Every major serverless platform charges on three dimensions simultaneously: request count, execution duration, and memory allocation. Understanding all three is necessary to predict costs — optimizing only one while ignoring the others is a common source of surprise bills.
Per-invocation charge
Every function call costs something regardless of how long it runs. AWS Lambda charges $0.20 per 1 million requests (after a 1M/month free tier). Azure Functions charges $0.20 per 1 million executions on the Consumption plan. Google Cloud Run charges $0.40 per 1 million requests. These headline rates look negligible — $0.20 for a million calls is $0.0000002 per call. But at 100M requests/month, that's $20 just in request fees before a single millisecond of compute.
Duration charge
This is the dominant cost for most workloads. Lambda charges $0.0000166667 per GB-second — the product of memory allocated (in GB) and wall-clock execution time (in seconds). A 512 MB function running for 200 ms consumes 0.5 GB × 0.2 s = 0.1 GB-seconds, costing $0.00000167. Multiply that by 10 million invocations and you get $16.70/month from duration alone — on top of $2 in request fees.
Duration is billed in 1 ms increments on Lambda (since 2020), 1 ms on Azure Functions, and 100 ms on Cloud Run (though Cloud Run bills CPU and memory separately rather than as a unified GB-second rate). The minimum billing increment matters: a function that takes 1 ms still gets billed for 1 ms, but a function that takes 101 ms on Cloud Run gets billed for 200 ms.
Memory allocation
Memory is the lever most developers ignore after initial setup. Lambda lets you allocate 128 MB to 10,240 MB in 1 MB increments. CPU scales proportionally: at 1,769 MB you get one full vCPU. Allocating more memory than your function uses is pure waste at $0.0000166667/GB-second. Allocating too little forces functions to run longer (increasing duration cost) and risks out-of-memory errors that trigger retries — paying twice or three times for the same work.
The practical rule: profile your function's actual memory usage in production, then add a 20–30% headroom buffer. Don't default to 128 MB out of habit; don't default to 1,024 MB out of caution. Both habits cost money unnecessarily.
Lambda vs Azure Functions vs Cloud Run pricing
The three dominant serverless platforms price similarly in structure but differ enough in rates, free tiers, and billing increments to matter at scale. Here is a side-by-side comparison using 2026 list prices.
| Dimension | AWS Lambda | Azure Functions | Google Cloud Run |
|---|---|---|---|
| Request price | $0.20 / 1M | $0.20 / 1M | $0.40 / 1M |
| Duration rate | $0.0000166667 / GB-s | $0.000016 / GB-s | $0.00002400 / vCPU-s + $0.0000025 / GB-s |
| Free tier (monthly) | 1M requests + 400K GB-s | 1M executions + 400K GB-s | 2M requests + 360K vCPU-s + 180K GB-s |
| Min billing increment | 1 ms | 1 ms | 100 ms (min 1 CPU) |
| Max timeout | 15 min | 10 min (Consumption) | 60 min |
| Cold start (p50) | ~100–300 ms (Node/Python) | ~200–600 ms (.NET/Node) | ~80–200 ms (containers) |
| Concurrency model | 1 instance per request | 1 instance per request | Up to 1,000 req/instance |
| Always-on option | Provisioned Concurrency (+$) | Premium plan (+$) | Min instances (+$) |
Cloud Run's concurrency model is a meaningful differentiator. Lambda and Azure Functions spin up one instance per concurrent request — 500 simultaneous requests means 500 cold starts on a fresh deployment. Cloud Run can serve up to 1,000 requests per container instance, so a bursty workload that would cost $50 in Lambda cold-start compute might cost $5 on Cloud Run because fewer instances need to start. For I/O-bound workloads with natural concurrency (API proxies, webhooks, async tasks), Cloud Run's model wins on both cost and latency.
Azure Functions on the Consumption plan is functionally equivalent to Lambda in pricing and model. The main practical differences: Azure Functions integrates more tightly with Azure Service Bus and Cosmos DB triggers, while Lambda has deeper native integration with EventBridge, Kinesis, and DynamoDB Streams. If you're already paying for those adjacent services, pick the platform that reduces cross-service data transfer charges.
Provisioned Concurrency costs
Eliminating cold starts requires pre-warming instances. Lambda Provisioned Concurrency costs $0.000004646/GB-second of provisioned time — billed whether requests come in or not. Keeping 10 instances of a 512 MB Lambda pre-warmed 24/7 adds $10.22/month. At 20 instances it's $20.44/month. That's before request and duration charges. Model this carefully before enabling it — the latency improvement is real, but so is the always-on cost.
When serverless beats containers (and when it doesn't)
The fundamental economics of serverless vs containers come down to utilization. A container running at 5% CPU utilization wastes 95% of what you pay for. A serverless function running at 5% utilization costs 5% of equivalent continuous compute — you pay only for what runs. As utilization climbs toward 100%, containers become cheaper because the per-unit overhead of serverless request fees and billing granularity adds up.
The crossover calculation
A single t4g.small on AWS (2 vCPU, 2 GB RAM) costs $0.0168/hr on-demand — $12.10/month. That instance can serve roughly 1,000–5,000 requests per second depending on workload type. At 1M requests/day (11.6 req/sec average) with 200 ms average duration and 512 MB memory allocation, Lambda costs:
Requests: 30M/month × $0.20/1M = $6.00
Duration: 30M × 0.2s × 0.5 GB × $0.0000166667 = $50.00
Raw Lambda total: $56.00/month
t4g.small equivalent: $12.10/month
(ignoring EC2 infra overhead: load balancer ~$18, networking ~$5)
At 30M requests/month with 200 ms average duration, Lambda is already 4× more expensive than a single small EC2 instance on raw compute. Add API Gateway ($3.50/1M = $105/month) and the comparison is stark. The crossover in this scenario sits around 3–5M requests/month, not 30M — roughly 100K–170K requests/day.
That crossover shifts dramatically based on function duration. A function averaging 50 ms instead of 200 ms costs one-quarter as much on duration. The same 30M/month workload at 50 ms and 256 MB costs:
Requests: 30M/month × $0.20/1M = $6.00
Duration: 30M × 0.05s × 0.25 GB × $0.0000166667 = $6.25
Raw Lambda total: $12.25/month
(now competitive with a t4g.small)
Short-duration, lightweight functions remain cost-competitive with containers well beyond 1M requests/day. Long-duration, memory-hungry functions cross over much earlier — sometimes below 100K requests/day.
When serverless wins
- Bursty, unpredictable traffic with long idle periods (nightly jobs, webhook handlers, cron tasks)
- Event-driven pipelines where individual items take under 100 ms to process
- Infrequent background tasks — data exports, report generation, notification dispatch
- Dev and staging environments that don't justify dedicated instances
- Workloads under ~1–5M requests/month depending on duration and memory
When containers win
- Sustained high-traffic APIs with predictable load above 1M requests/day
- Long-running compute — ML inference, video processing, anything over 5 seconds average
- Workloads sensitive to cold-start latency that would require expensive Provisioned Concurrency
- Stateful workloads that need in-process caching or local disk
- Microservice meshes where inter-service calls are frequent (cross-function invocation costs add up)
Use our serverless cost calculator to model your specific invocation count, duration, and memory against equivalent container costs. The crossover is not universal — it depends on your exact parameters.
Cost by scale: 1K to 10M invocations/month
The table below models total Lambda cost (compute only — no API Gateway) for a 512 MB function with 200 ms average duration. Free tier is excluded to show true marginal cost. All figures use us-east-1 2026 list prices.
| Invocations / month | Request fee | Duration fee | Lambda total | + API GW (REST) |
|---|---|---|---|---|
| 1,000 | $0.0002 | $0.0017 | $0.0019 | +$0.0035 |
| 100,000 | $0.02 | $0.17 | $0.19 | +$0.35 |
| 1,000,000 | $0.20 | $1.67 | $1.87 | +$3.50 |
| 5,000,000 | $1.00 | $8.33 | $9.33 | +$17.50 |
| 10,000,000 | $2.00 | $16.67 | $18.67 | +$35.00 |
| 50,000,000 | $10.00 | $83.33 | $93.33 | +$175.00 |
| 100,000,000 | $20.00 | $166.67 | $186.67 | +$350.00 |
At 10M invocations/month the Lambda compute bill is $18.67 — reasonable. But adding REST API Gateway ($35) and CloudWatch Logs (~$7.50 at 500 bytes/invocation) brings the real number to $61.17. That's 3.3× the headline compute figure. This pattern — raw compute being a fraction of total serverless cost — repeats at every scale.
At 100M invocations/month with API Gateway, the total bill exceeds $500/month. At that scale, a fleet of four t4g.medium instances behind an ALB costs approximately $140/month with far better latency consistency. The architectural pivot pays for itself quickly. For help modeling your specific numbers, use the serverless cost calculator or review our cloud cost optimization checklist for cross-cutting reduction strategies.
Optimization tips
The highest-leverage serverless optimizations target the cost components that scale with volume — API Gateway choice, log verbosity, memory tuning — rather than the compute rate itself, which you cannot negotiate.
1. Switch from REST API Gateway to HTTP API or ALB
For most Lambda backends, HTTP API ($1.00/1M) or ALB ($0.008/1M) is a direct substitute for REST API ($3.50/1M). If you don't need REST API-specific features (request validation schemas, usage plans, WAF integration, caching), switch. At 10M calls/month the saving is $25/month. At 50M calls/month it's $125/month. This is a configuration change, not an architectural one.
2. Right-size memory allocation with Lambda Power Tuning
AWS's open-source Lambda Power Tuning tool runs your function at every memory configuration from 128 MB to 10,240 MB and reports actual duration and cost at each level. Functions often run fastest — and cheapest — at a setting other than their current allocation. A function set to 1,024 MB might complete in 180 ms, while at 512 MB it takes 400 ms. At $0.0000166667/GB-s:
1024 MB / 180 ms: 1.0 × 0.18 × $0.0000166667 = $0.000003000
512 MB / 400 ms: 0.5 × 0.40 × $0.0000166667 = $0.000003333
1024 MB is cheaper despite using more memory — CPU scaling effect
Run Lambda Power Tuning on your top five functions by invocation count. The results frequently reveal 10–30% savings with no code changes.
3. Use ARM64 (Graviton2) architecture
Lambda on ARM64 costs 20% less per GB-second than x86: $0.0000133334 vs $0.0000166667. Most Node.js, Python, and Go functions run without modification on ARM64. Java and .NET functions require rebuilding. For a function spending $50/month on duration, switching to ARM64 saves $10/month — immediately, with a single configuration change and a redeployment. The only reason not to make this change is a dependency that doesn't have an ARM64 build.
4. Reduce log verbosity and set retention
Default Lambda log groups have no retention policy — logs accumulate indefinitely at $0.03/GB/month. Set a 30-day or 7-day retention policy on all Lambda log groups. AWS CloudFormation and CDK let you set this at deployment time. For a function generating 1 GB/month of logs, uncapped retention grows storage costs by $0.36/month every month indefinitely. At 12 months without cleanup that's $21.60 in accumulated log storage for one function.
5. Batch event processing
For queue-driven workloads (SQS, Kinesis), increasing the batch size reduces the number of Lambda invocations for the same throughput. Processing 10 SQS messages per invocation instead of 1 reduces request fees by 10× and amortizes cold starts across 10 items instead of one. Duration cost increases proportionally, so the saving comes purely from reduced invocation count and cold-start overhead. This works particularly well for workloads where the per-message processing time is short relative to function initialization time.
6. Use Compute Savings Plans for predictable Lambda spend
If your Lambda invocation count is predictable (not bursty), Compute Savings Plans apply to Lambda duration charges and provide 17% savings compared to on-demand rates in us-east-1. A 1-year, no-upfront Compute Savings Plan that covers $100/month of Lambda duration saves $17/month — $204/year. This is often overlooked because Savings Plans are mentally associated with EC2, but they apply to Lambda too.
Quick optimization checklist
- Switch REST API Gateway to HTTP API or ALB where possible — saves 70–99% of API GW cost
- Run Lambda Power Tuning on high-volume functions — typical saving: 10–30%
- Switch to ARM64 (Graviton2) — saves 20% on duration with no code changes for most runtimes
- Set CloudWatch log retention to 7 or 30 days on all Lambda log groups
- Gate verbose logging behind a LOG_LEVEL env var and sample successful requests
- Increase SQS/Kinesis batch size for queue-driven workloads
- Evaluate Compute Savings Plans if Lambda spend is predictable
Predictable pricing beyond the per-invocation model
If per-request billing and hidden adders like API Gateway and CloudWatch Logs make forecasting hard, these providers offer flat-rate alternatives for running the same workloads.
- DigitalOcean — App Platform and Functions with flat, predictable pricing instead of per-invocation billing that scales unpredictably.
- Hetzner — unbeatable price/performance for always-on compute once your request volume crosses the serverless crossover point.
- Vultr — global low-cost VPS sizing as a fixed-cost alternative once container instances start beating per-invocation pricing.
Some provider links above are affiliate links — we may earn a commission at no extra cost to you. It never affects our pricing data.
Frequently asked questions
Is serverless always cheaper than containers?
No. Serverless is cheaper for low-volume, bursty, or irregular workloads — typically under 1–5M requests/month depending on function duration. Above that threshold, and almost certainly above 10M requests/month for typical API functions, a single always-on container instance is less expensive than equivalent serverless invocations plus API Gateway. The crossover point depends heavily on average function duration: short functions (under 50 ms) remain competitive at much higher volumes than long-running ones (over 500 ms).
What is the AWS Lambda free tier and does it last?
AWS Lambda's free tier includes 1 million requests and 400,000 GB-seconds of compute per month, permanently — it does not expire after 12 months like some other AWS free tier offers. For a 512 MB function running 200 ms on average, 400,000 GB-seconds covers 4 million invocations. Once you exceed either the request or compute free tier, standard pricing applies to the overage. The free tier is per-account, not per-function, and applies across all Lambda functions in all regions.
How do I reduce AWS Lambda costs for high-traffic APIs?
The highest-impact changes in order: (1) switch from REST API Gateway to HTTP API or ALB — this alone can halve your serverless bill; (2) switch to ARM64 architecture for an immediate 20% duration savings; (3) run Lambda Power Tuning to find the optimal memory setting; (4) reduce log verbosity and set CloudWatch log retention. If traffic is consistently high (above 10M requests/month), also evaluate whether containers are a better fit architecturally and use our serverless cost calculator to model the comparison.
What is a Lambda cold start and how much does it cost?
A cold start occurs when Lambda needs to initialize a new execution environment — downloading the deployment package, starting the runtime, and running initialization code — before handling a request. For Node.js and Python functions, cold starts typically add 100–300 ms. For JVM and .NET functions, they can add 1–3 seconds. The cost impact is primarily in extended duration for those first invocations. More significantly, cold starts can trigger timeouts and retries that bill the same work multiple times. Provisioned Concurrency eliminates cold starts but adds a fixed always-on cost of $0.000004646/GB-second regardless of traffic.
How does Google Cloud Run pricing compare to Lambda?
Cloud Run bills CPU ($0.00002400/vCPU-second) and memory ($0.0000025/GB-second) separately rather than as a unified GB-second rate. It also supports up to 1,000 concurrent requests per container instance, meaning bursty traffic doesn't necessarily trigger proportional new instance starts. Cloud Run's free tier (2M requests, 360K vCPU-seconds, 180K GB-seconds/month) is more generous than Lambda's on the compute side. For I/O-bound, high-concurrency workloads — API proxies, webhooks, streaming — Cloud Run's model is often 40–70% cheaper than Lambda for the same traffic pattern.
Should I use serverless for a startup API backend?
For early-stage startups under 500K requests/day, serverless is almost always the right starting point. Zero idle cost, no capacity planning, and automatic scaling from zero let you focus on product without managing infrastructure. The calculus changes as traffic grows — budget time to model the serverless vs container comparison when you approach 10M requests/month, and plan for the migration before it becomes urgent. See our cloud cost optimization checklist for broader cost management strategies as you scale.
Estimate your cloud costs — for free
Compare AWS, Azure, and GCP pricing side by side with our free calculator, and dig into the guides to learn how to cut cloud waste. No sign-up required.