Skip to content
BENIBIX Learn

Function as a Service (FaaS)

Infrastructure☁️ Virtualization & CloudCloud Service Models

Also known as FaaS, Cloud Function, Serverless Function, AWS Lambda

Upload one small function. The cloud runs it each time something happens.

Think of it like

Think of it like a doorbell. Nothing happens until someone presses it. Then it rings once.

Example

Lucy writes an AWS Lambda function that sends a welcome email. It runs once for each new sign-up, about 300 times a day, and costs her a few cents a month.

Why it matters

It is the cheapest way to run small jobs that come now and then. Nothing has to stay on.

Definition

Function as a service is the most common kind of serverless. You upload one small function, and the cloud runs it each time an event happens. The event might be a web request, a new file or a timer. Each run starts, does its job and stops. You pay per run and per millisecond. All the big clouds sell it under their own names.

Example code

javascript
export const handler = async (event) => {
  return { statusCode: 200, body: 'Hello' };
};
One small function. The cloud runs it for every request it gets.

Common mistake

Putting a long job in one function. Most platforms stop a run after a set time, often 15 minutes or less.

Key takeaways

  1. 1
    One small function. Not a whole app.
  2. 2
    Runs on events. Request, file, timer.
  3. 3
    Pay per run. And per millisecond.

Learn it properly