☁️Function as a Service (FaaS)
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
Example code
javascript
export const handler = async (event) => {
return { statusCode: 200, body: 'Hello' };
};Common mistake
Key takeaways
- 1One small function. Not a whole app.
- 2Runs on events. Request, file, timer.
- 3Pay per run. And per millisecond.