Understanding Serverless Computing
Serverless and Cloud Functions ⚡
So far you've met two ways of running an application: a virtual machine, which is a software-based computer you size, patch, and keep running, and a container, which packages your application and shares an operating system with other containers. Both have something in common. Something is always running, and you are always paying for it. Serverless is what happens when you remove that assumption entirely.
In this lesson, you will learn to:
- Explain what serverless computing and cloud functions do, including who manages the infrastructure.
- Identify event-driven workloads that fit cloud functions and workloads that do not.
- Describe scale-to-zero, per-execution pricing, and cold-start trade-offs.
What Serverless Actually Means đź§
Serverless computing is a slightly misleading name. Servers absolutely still exist, and your code still runs on real machines in a real data center. What changes is who thinks about them. With serverless, the provider owns the machines, decides how many are needed, patches them, replaces them when they fail, and hands you back a much smaller job: write the piece of code and say what should set it off.
That piece of code is called a cloud function. It is small, it does one thing, and it sits dormant until something triggers it. A trigger might be a file landing in storage, a message arriving, a clock reaching 2 a.m., or a request hitting a web address. When the trigger fires, the provider finds a machine, runs your code, returns the result, and tears everything down again. You are billed for the moments it actually ran, usually measured in fractions of a second, plus the number of times it was invoked.

Every major provider offers this. On Amazon Web Services it is AWS Lambda, on Microsoft Azure it is Azure Functions, and on Google Cloud it is Cloud Run Functions. The names differ; the shape of the idea does not.
Here is how that distinction might sound when Jessica, a product colleague, presses Natalie, a cloud advisor, on where the money actually goes.
- Jessica: If it's called serverless, where does my code actually run?
- Natalie: On servers. The provider's servers. You just never see them, name them, or log into them.
- Jessica: So what am I paying for, if there's no machine sitting there?
- Natalie: Executions. Each time the function fires and for how long it ran. Nothing fires, nothing is billed.
- Jessica: That feels backwards after months of paying for a machine that's idle half the night.
Notice that Natalie does not defend the word "serverless." She redefines it around the only thing that matters to the person asking: who manages the machine, and what shows up on the bill.
Which Workloads Fit âś…
The pattern to look for is short, event-shaped work: something happens, a small piece of code responds, and then nothing happens again for a while. Three examples cover most of what you'll meet. A photo is uploaded and a function generates a thumbnail. A nightly report needs to run at 2 a.m. and takes forty seconds. An outside system sends a webhook, which is simply an automated message announcing that something happened elsewhere, and a function receives it and reacts.
What these share is that the work is brief, it is triggered rather than continuous, and it can start fresh each time without needing to remember anything from the last run.
The mirror image is just as important. A busy database that must be reachable every second of every day is a poor fit, because it never stops and never idles. A four-hour video encoding job is a poor fit, because cloud functions carry a maximum run time (commonly a few minutes to fifteen minutes, depending on the provider) and are billed by duration, so long jobs are both awkward and expensive. A legacy application that must stay permanently running is a poor fit for the same reason. Consequently, when someone proposes moving everything to serverless, the honest answer is usually that some of it fits beautifully and some of it does not.
Cost, Scaling, and Cold Starts ⏱️
The financial appeal of serverless comes from one property: scaling to zero. When nothing triggers the function, no copies of it exist and nothing is billed. An always-on server has no equivalent behaviour; it costs the same at 3 a.m. with no users as it does at noon. Moreover, scaling upward is automatic. If a thousand uploads arrive at once, the provider runs a thousand copies of your function without you configuring anything.
That logic breaks in a predictable place. Once a workload is steady and high-volume, per-execution pricing overtakes the flat hourly cost of a machine you were going to pay for anyway. Serverless is cheapest when demand is spiky or rare, and often more expensive when demand is constant.
There is also a user-facing catch. A function that hasn't run recently has no copy ready and waiting, so the provider must set one up and load your code before it can respond. That startup delay is called a cold start, and it typically adds anywhere from a fraction of a second to a couple of seconds. For a 2 a.m. report, nobody notices. For a shopper waiting on a checkout page, they might. Providers offer ways to keep copies warm, but doing so costs money and quietly erodes the scale-to-zero saving.
The takeaway worth carrying: serverless removes the server from your job description and the idle hours from your bill, but it earns that saving only for short, spiky, event-triggered work. Next you'll do a quick self-check on what serverless really means, then sort real workloads into the ones that belong on functions and the ones that belong on an always-on machine, and finally take a short call with Nova, a product manager convinced serverless is always cheaper, where you explain how cloud functions really bill and agree on one pilot workload to start with.
