AWS Lambda
Also known as: AWS Lambda function, serverless function, FaaS
Lambda is AWS's serverless compute service.
You write a function (in Python, Node.js, Java, or other languages), upload it to Lambda, and it runs whenever triggered -- by an HTTP request, a file upload to S3, a database change, or a scheduled timer. You pay only for the milliseconds your code runs.
AWS Lambda, explained at three levels
At home
Imagine you only need to run some code when a user uploads a photo -- not constantly, just then. Lambda lets you do that. You write the code, and AWS runs it exactly when needed. You're not charged when nothing is happening.
At work
Lambda eliminates the need to manage servers for tasks that don't run continuously. Instead of keeping a server running 24/7 to resize images, you write a Lambda function that fires whenever a new image arrives and terminates when done.
At home
Lambda functions have a maximum runtime of 15 minutes, up to 10 GB of memory, and ephemeral local disk. They can be triggered by API Gateway (HTTP), S3 events, DynamoDB streams, SQS queues, EventBridge schedules, and dozens of other AWS services. Cold starts (the first invocation after idle time) add latency -- typically 100ms to 1s depending on runtime.
At work
Lambda scales automatically -- AWS can run thousands of concurrent executions without any configuration. This makes it ideal for unpredictable workloads. Common patterns: API backends via API Gateway, ETL pipelines triggered by S3 uploads, real-time stream processing with Kinesis, and scheduled data jobs via EventBridge.
At home
Lambda's execution environment is a micro-VM (Firecracker) that's reused for warm invocations. Code and dependencies outside the handler function (the initialization phase) persist across warm invocations -- a pattern used to cache database connections or SDK clients across calls.
At work
Lambda's concurrency model has account-level limits (default 1000) and per-function reserved or provisioned concurrency. Provisioned concurrency eliminates cold starts at a cost. Lambda@Edge and CloudFront Functions run code at CDN edge nodes globally. For complex workflows, Step Functions orchestrates sequences of Lambda functions with branching, retries, and parallel execution.
Real-world examples
At home
Fatima built a Lambda function that runs every night at midnight (triggered by EventBridge Scheduler) to fetch the day's weather data from a free API and save it to S3. Zero servers, zero idle cost.
At work
Marcus's team uses Lambda with API Gateway to power their REST API. Each endpoint is a separate Lambda function written in Python. During a product launch with 50x normal traffic, Lambda scaled automatically -- they noticed nothing in the logs except increased invocation counts.
Common confusions
- Serverless means there are no servers — There are still servers -- you just don't manage them. AWS provisions, patches, and scales the underlying infrastructure. 'Serverless' means server-free for you, not server-free in reality.
- Lambda is always cheaper than EC2 — Lambda is cheaper for intermittent, low-volume workloads. For continuous high-throughput processing, EC2 or containers are often more cost-effective because Lambda's per-invocation billing adds up.
For analysts
BAs can use Lambda to automate data pipelines -- a Lambda triggered by an S3 upload can clean and transform a CSV, load it into a database, and send a Slack notification, all without IT involvement once set up.
History & origin
AWS launched Lambda in 2014, coining the term 'serverless' as a category. The idea -- code that runs on demand without servers you manage -- was radical at the time. Lambda popularized event-driven architectures and spawned a wave of serverless services. Today all major cloud providers offer equivalent services (Azure Functions, Google Cloud Functions), and serverless is a mainstream architectural pattern.