Serverless Functions Bill per Invocation, So Idle Code Costs Nothing
Function as a Service (FaaS: AWS Lambda, Google Cloud Functions, Azure Functions) runs a piece of code in response to an event and charges for the execution, not for a server waiting for work. A function that is never called costs nothing; one called a million times costs a million small amounts. That pricing makes FaaS cheap for sporadic, bursty work and expensive for steady, heavy load.
What the Customer Still Owns
FaaS sits beyond PaaS in the shared stack: the provider runs servers, operating system, runtime and scaling, and starts instances on demand. The customer writes the function code and stays responsible for the data it handles and for who may invoke it.
How the Bill Is Built
- Duration: time each invocation runs, measured in small increments (milliseconds on some platforms).
- Resources: the memory (and sometimes CPU) allocated to the function multiplies the duration.
- Requests: a small fee per invocation.
- Events: HTTP calls, file uploads, queue messages or database changes trigger the runs; no events, no charge.
Scaling is automatic: ten simultaneous events start ten instances, and the bill follows.
When It Fits and When It Doesn't
| Fits | Doesn't fit |
|---|---|
| webhooks, file processing, scheduled jobs | long-running processes (platforms cap execution time) |
| unpredictable or low traffic | constant high traffic, where a VM or container is cheaper per request |
| glue between managed services | latency-critical paths sensitive to cold starts |
A cold start (the first request after idle, which has to start an instance) adds latency the provider's other models don't have.
References
- Cloud Computing MOC - hub for cloud notes.
- Cloud Service Models Differ by Which Layers the Customer Still Manages - FaaS as the next step after PaaS in the responsibility split.
- Cloud Turns Infrastructure from Capital Expense into Operating Expense, Which Is Why FinOps Exists - why a pay-per-use bill needs active cost control.
- AWS Lambda documentation: What is AWS Lambda? - an example of event-driven functions and their limits.
Review cards
Flashcard Why is serverless function pricing per invocation beneficial for sporadic workloads?
Serverless functions charge based on the actual execution time and resources used, so they are cost-effective for workloads that are unpredictable or infrequent.
Flashcard What does the customer own in a serverless function environment?
The customer owns the function code and is responsible for the data it handles and who may invoke it.
Quiz Which of these is NOT part of a serverless function's execution bill?
- Duration of each invocation
- Memory allocated to the function
- Number of requests
- The size of the function's source code
The bill multiplies duration by allocated resources and adds a small fee per request. No invocation, no charge.