Tech Terms Explained Open in the app →

AWS Lambda

Cloud Computing · Intermediate · 4 min read

What is it?

AWS Lambda runs your code in response to events without you managing any servers, and you pay only while it runs.

Explain like I'm 5

Lambda is like a motion-sensor light: it switches on only when something happens, does its job, and switches off — you never pay to keep it glowing all day.

Why was it created?

Running idle servers waiting for occasional work is wasteful. Lambda was created so code runs only when triggered, with scaling and servers handled for you.

Where is it used?

  • Event-driven processing
  • Lightweight APIs
  • Automation and scheduled jobs
  • Reacting to file uploads or messages

Why should developers care?

Lambda is a flagship serverless service used widely for glue code, APIs, and automation in cloud systems.

How does it work?

You upload a function and connect it to triggers (an HTTP request, a file upload, a queue message, a schedule). When a trigger fires, AWS runs your function, scales it automatically, and bills by execution time.

Real-world example

When an image is uploaded to S3, a Lambda function automatically runs to create a thumbnail — no server sits waiting in between.

Common use cases

  • Processing events and streams
  • Backends for APIs
  • Scheduled tasks
  • Glue between cloud services

Advantages

  • No servers to manage
  • Scales automatically
  • Pay only for execution time
  • Fast to deploy small functions

Disadvantages

  • Cold starts add latency
  • Time and resource limits per run
  • Harder to debug locally
  • Can encourage sprawl of tiny functions

When should you use it?

For event-driven or spiky workloads where you don't want to run servers full-time.

When should you avoid it?

For long-running, steady, or latency-critical workloads better suited to containers or EC2.

Alternatives

EC2Containers (ECS/EKS)Other serverless platforms

Related terms

AWSAmazon EC2API GatewayAWS Step FunctionsEvent-Driven Architecture

Interview questions

Beginner

  • What is serverless?
  • What triggers a Lambda function?

Intermediate

  • What is a cold start?
  • How is Lambda billed?

Senior

  • How do you reduce cold-start latency?
  • When is serverless a poor fit?

Common misconceptions

  • "Serverless means there are no servers" — servers exist; you just don't manage them.
  • "Lambda is always cheaper" — for steady high-volume workloads, dedicated compute can cost less.

Fun facts

  • A 'cold start' is the extra delay when a function runs after being idle.
  • Lambda popularized the term 'serverless' for everyday developers.

Timeline

  • 2014 — AWS Lambda announced

Learning resources

Quick summary

AWS Lambda runs your code on demand in response to events, scaling automatically and billing only for execution time.

Cheat sheet

  • Serverless functions
  • Runs on events, scales automatically
  • Pay per execution
  • Mind cold starts and time limits

If you remember only one thing

Lambda runs your code only when an event fires — no servers to manage, pay only while it runs.