Last updated

Lambda & Serverless

Definition: AWS Lambda runs your code without you managing any servers. You upload a function; AWS runs it on demand and bills you only for the milliseconds it executes. This approach is called serverless.

How it works

You write a small function (in Python, Node.js, and more). It runs in response to an event — a file uploaded to S3, an API request, a scheduled timer, a database change. No servers to provision, patch, or scale; AWS handles all of it.

Why people love serverless

  • No servers to manage — focus purely on code
  • Pay per use — nothing runs, nothing to pay; great for spiky workloads
  • Automatic scaling — from zero to thousands of runs instantly

When it fits

Lambda shines for event-driven tasks, APIs, automation, and glue between services. For long-running, constant workloads, a traditional server (EC2) can be cheaper.

💡 Mental model: EC2 is renting a whole server; Lambda is renting a few seconds of compute, only when your code actually runs.

Ad · responsive