# Function as a Service (FaaS)

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

**Field:** Infrastructure  
**Category:** Virtualization & Cloud  
**Also known as:** FaaS, Cloud Function, Serverless Function, AWS Lambda

## Think of it like

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

## 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

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.

## 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.

## Why it matters

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

## Common mistake

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

## Three principles

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

## Related terms

- [Serverless Computing](https://learn.benibix.com/term/infrastructure/serverless-computing)
- [Webhook](https://learn.benibix.com/term/development/webhook)
- [Platform as a Service (PaaS)](https://learn.benibix.com/term/infrastructure/platform-as-a-service)
- [Cloud Provider](https://learn.benibix.com/term/infrastructure/cloud-provider)

## Taught in

- [Serverless and FaaS](https://learn.benibix.com/learn/infrastructure-virtualization/serverless-and-faas): Cloud Computing, 5/11

---

Source: https://learn.benibix.com/term/infrastructure/function-as-a-service
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-18
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
