Loading...


Updated 5 Oct 2026 • 5 mins read

Serverless computing is a cloud model in which the provider runs your code on demand and bills only for execution, with no servers to provision or manage. This guide explains how it works, compares AWS Lambda, Azure Functions, and Google Cloud Run on price, works through a cost example, and shows when serverless is cheaper than containers or VMs.
The name is the first obstacle. Serverless computing runs on servers, a great many of them, owned and operated by the cloud provider. What the word actually describes is your relationship to those servers: you never see them, size them, patch them, or pay for them while they sit idle. You hand the provider a function, the provider runs it when something triggers it, and you are billed for the milliseconds it ran. Then it stops, and so does the meter.
That last sentence is why serverless matters to anyone who pays a cloud bill, and it is also where the model gets misunderstood in both directions: treated as always cheaper when it is not, or dismissed as a toy when it quietly runs much of the modern internet. This guide explains what serverless computing is, how it works under the hood, how it is priced across AWS Lambda, Azure Functions, and Google Cloud Run, where the hidden costs sit, and how to decide when it is the right model and when a container or a plain server is.
The short answer: Serverless computing is a cloud execution model in which the provider automatically runs your code in response to events, allocates and scales the underlying servers for you, and bills only for the resources consumed while the code runs, typically measured in requests and GB-seconds. You write functions; the platform handles provisioning, scaling to zero when idle, and scaling out under load. AWS Lambda charges $0.20 per million requests plus $0.0000166667 per GB-second, with one million requests and 400,000 GB-seconds free every month; Azure Functions is priced almost identically and Google Cloud Run bills CPU and memory separately. Serverless is cheapest for variable or low-volume workloads that would otherwise leave servers idle, and often more expensive than containers for steady, high-volume load.
Serverless is a cloud execution model, not a technology or a product. In the traditional model, which our explainer on what the cloud is covers, you rent a virtual machine or a container, keep it running, and pay for every hour whether it is busy or not. In the serverless model, you deploy code and declare what should trigger it. The provider keeps the code ready, runs an instance when a trigger fires, runs more instances in parallel if many triggers arrive at once, and shuts them all down when the triggers stop. You are billed per execution, for the memory allocated multiplied by the time the code ran, usually to the millisecond.
Three properties follow from that and define the model. Serverless is event-driven: code runs because something happened, an HTTP request, a message on a queue, a file landing in storage, a timer. It scales to zero: no traffic means no instances and no compute charge, which no virtual machine can do. And it is fully managed: the provider owns the operating system, the runtime, patching, capacity, and availability, which is what makes it the closest real-world expression of the NoOps idea we describe in our
Understanding the mechanics explains both the economics and the limitations. When you deploy a serverless function, the provider stores your code and its configuration, including how much memory it may use and what events trigger it. Nothing runs yet. When a trigger fires, the platform finds or creates an execution environment, a lightweight isolated container with your runtime loaded, and invokes your function with the event as input. If another trigger arrives while that environment is busy, the platform creates a second one, and a third, scaling horizontally with demand up to a concurrency limit.
Creating a fresh environment takes time, from tens of milliseconds to a few seconds depending on the runtime and the size of your code, and that delay is the cold start. Once an environment exists, the platform keeps it warm for a while and reuses it for subsequent invocations, which is why the second request is fast and the first is not. When traffic stops, warm environments are eventually reclaimed, and the function returns to costing nothing. Because environments are created and destroyed freely, functions must be stateless: anything that needs to persist between invocations lives in a database, a cache, or object storage rather than in the function's memory.
The word covers more than functions, and the distinctions matter when choosing a platform.
A fourth, edge functions from providers such as Cloudflare Workers, runs tiny functions at hundreds of locations close to users, with its own pricing and constraints. The container flavor is where serverless meets the orchestration world we cover in our guide to container orchestration.
Serverless pricing has two components almost everywhere: a fee per request and a fee for compute consumed, measured as memory multiplied by execution time. The table shows the standard consumption-based tiers in US regions as of October 2026; rates change and vary by region, so confirm on each provider's pricing page, such as the Lambda pricing page.
| Platform | Request price | Compute price | Always-free allowance | Notes |
|---|---|---|---|---|
| AWS Lambda (x86) | $0.20 per 1M | $0.0000166667 per GB-second | 1M requests + 400,000 GB-seconds / month | 15-minute max duration; 1 ms billing |
| AWS Lambda (Arm / Graviton) | $0.20 per 1M | $0.0000133334 per GB-second | Same as x86 | About 20% cheaper compute |
| Azure Functions (Consumption) | $0.20 per 1M executions | ~$0.000016 per GB-second | 1M executions + 400,000 GB-seconds / month | Flex Consumption and Premium plans also available |
| Google Cloud Run | $0.40 per 1M | $0.000024 per vCPU-second + $0.0000025 per GiB-second | 2M requests + 360,000 vCPU-s + 180,000 GiB-s / month | Runs containers; up to 1,000 concurrent requests per instance |
| Cloudflare Workers | Included in plan | Included in plan | 100,000 requests / day free | Paid plan from $5 / month for 10M requests; edge runtime |
Two readings of that table are worth drawing out. Lambda and Azure Functions are priced almost identically, so the choice between them is ecosystem rather than cost. And Cloud Run's larger free tier and ability to serve many requests from one instance can make it markedly cheaper for I/O-bound, high-concurrency work, while its double per-request fee makes it pricier for request-heavy, compute-light functions. The platform that is cheapest depends on the shape of your traffic, not on the headline rate.
Consider an API handling 10 million requests a month on AWS Lambda, each running for 200 milliseconds at 512 MB of memory, on x86. Compute is 10 million times 0.2 seconds times 0.5 GB, which is 1 million GB-seconds; subtract the 400,000 free and 600,000 GB-seconds bill at $0.0000166667 each, about $10. Requests: 9 million billable at $0.20 per million, about $1.80. Lambda compute for a 10-million-request API comes to roughly $12 a month.
Now add what the function needs around it. An HTTP API through Amazon API Gateway bills about $1 per million requests, so $10. CloudWatch Logs at $0.50 per GB ingested, with each invocation writing a kilobyte of logs, is about 10 GB and $5, plus storage if retention is left at never-expire. Data transfer out at $0.09 per GB for, say, 50 GB of responses is about $4.50. If the function reaches a database inside a VPC, a NAT Gateway adds about $32 a month regardless of traffic. The realistic total is $30 to $65 a month, of which the Lambda compute everyone quotes is between a fifth and a third. The same pattern holds on every platform: the function is the cheap part.
The right comparison is not which is cheapest in the abstract but which cost model fits the workload.
| Dimension | Virtual machines | Containers (Kubernetes, ECS) | Serverless (FaaS) |
|---|---|---|---|
| What you manage | OS, runtime, scaling, patching | Cluster, images, scaling policies | Code and configuration only |
| Billing basis | Per hour or second, running or idle | Per node-hour, shared across pods | Per request and per GB-second executed |
| Idle cost | Full rate | Full rate for the nodes | Zero |
| Scaling | Manual or autoscaling groups, minutes | Pod and node autoscaling, seconds to minutes | Automatic, per request, sub-second |
| Startup latency | Minutes | Seconds | Milliseconds to seconds (cold start) |
| Execution limits | None | None | Duration and memory caps (15 min on Lambda) |
| Cheapest for | Steady, predictable, long-running load | High, steady load with many services | Bursty, variable, or low-volume workloads |
| Lock-in | Low | Low to moderate | Moderate to high (event model, provider services) |
Take a workload that needs the equivalent of one vCPU and 2 GB of memory while active. As an always-on t3.small-class server it costs roughly $15 a month for compute. On Lambda at 2 GB, each second of execution costs about $0.0000333, so a month of continuous execution would be about $86, far more than the server. But serverless does not run continuously. If the workload is active 20 percent of the time, Lambda costs about $17, roughly even with the server before the server's disk, IP, and management overhead. At 10 percent utilization Lambda costs about $9 and wins; at 50 percent it costs about $43 and loses badly.
The rule of thumb that falls out: workloads idle more than roughly half the time favor serverless on compute alone, and the advantage grows as utilization falls, which is why serverless dominates for scheduled jobs, webhooks, event processing, and APIs with uneven traffic. Workloads that run hot all day belong on containers or servers, ideally on a commitment discount. The honest version of serverless economics is not that it is cheap but that it charges you for exactly as much as you use, which is a bargain precisely when you use little.
Serverless bills surprise teams for a specific reason: the compute fee is small and visible, and everything around it is larger and spread across other services. The usual culprits, in rough order of size, are API gateway fees per request, logging ingestion and storage (our guide to CloudWatch pricing shows how a chatty function's logs can cost more than its compute), data transfer out, NAT Gateway charges for functions that reach into a VPC, provisioned concurrency to avoid cold starts, and the managed databases and queues the functions depend on. Add retries, which bill every attempt, and generous default memory settings, which multiply the GB-second rate, and a function priced at a few dollars can anchor a bill of a few hundred.
The fix is to treat the infrastructure template as the place cost is decided. Set log retention explicitly, right-size memory to what the function uses, cap concurrency and API throttling, and prefer VPC endpoints to NAT where possible, all of which can be written into the deployment definition, as we describe in our comparison of AWS SAM and CloudFormation.
Serverless changes the FinOps problem in one important way. On servers, cost is set when you provision and is visible as a resource with a tag. In serverless, cost is set by code and traffic, there is no long-lived resource to tag, and spend is spread across functions, gateways, logs, and data services that each appear on different lines. Attribution therefore has to happen at the function and event level, mapping each function to a team and a feature and summing everything it triggers, which is the same discipline we describe for AI unit economics and for the same reason: usage-based spend has no infrastructure to hang a label on. Done well, serverless gives you the cleanest unit economics in the cloud, a precise cost per request; done badly, it gives you a bill that grows with success and that nobody can decompose. Seeing it per function, per team, and alongside the rest of the estate is what Opslyft's cost visibility is built for.
Serverless computing is the cloud's purest form of pay-for-use: code that runs when triggered, scales without intervention, and costs nothing while idle. That makes it the cheapest and simplest option for a large class of variable and event-driven work, and a poor fit for steady, heavy, or long-running load, where its per-request margin turns against you. The platforms are mature and priced nearly alike, so the decision is about workload shape rather than vendor. Choose it where utilization is low and bursty, watch the costs that gather around the function rather than inside it, and attribute spend at the function level so that a bill which grows with success is a bill you can explain. The broader principles are in our guides to cloud pricing models and cloud elasticity, which serverless takes to its logical conclusion.
Serverless computing is a cloud model where you write code and the provider runs it on demand, allocating servers automatically and billing you only for the time your code actually executes. There are still servers, but you never provision, patch, or scale them. When nothing is running, you pay nothing for compute, which is the defining difference from a virtual machine or container that bills while idle.
No. Servers still run your code; the provider owns and operates them. 'Serverless' means they are abstracted away from you: you do not choose instance sizes, manage operating systems, or handle capacity. The term describes your experience as a developer, not the physical reality underneath.
By execution rather than by time provisioned. AWS Lambda, the most common example, charges $0.20 per million requests plus $0.0000166667 per GB-second of memory multiplied by execution time, with a permanent free tier of one million requests and 400,000 GB-seconds a month. Azure Functions prices almost identically; Google Cloud Run bills CPU and memory separately at $0.40 per million requests. You pay for what runs, not for what waits.
For variable, bursty, or low-volume workloads, usually yes, because idle time costs nothing. For steady, high-volume workloads running near capacity, usually no: at constant load a container or VM is cheaper per unit of compute, and serverless per-request fees add up. The crossover depends on utilization; workloads idle more than half the time typically favor serverless.
A cold start is the delay, usually tens of milliseconds to a few seconds, when a serverless platform has to initialize a new instance of your function because none is warm, for example after a period of no traffic. It affects latency-sensitive applications most. Providers offer options such as AWS Lambda Provisioned Concurrency to keep instances warm, at an extra always-on cost.
The compute fee is often the smaller part of a serverless bill. API Gateway charges per request, CloudWatch or equivalent logging bills per GB ingested and stored, data transfer out is billed, a function attached to a VPC may need a NAT Gateway at about $32 a month, and provisioned concurrency bills continuously. Logging in particular can exceed function compute cost on chatty functions.
Avoid serverless for long-running processes beyond the platform's execution limit (15 minutes on Lambda), for workloads with constant high load where containers are cheaper, for applications that cannot tolerate cold-start latency, for heavy stateful or in-memory workloads, and where tight vendor lock-in to one provider's event model is unacceptable.