What Is AWS Lambda? Serverless Functions Explained
AWS Lambda is a serverless compute service: you upload a function, AWS runs it on demand in response to events, and you pay only for the milliseconds it executes.
Lambda lets you run code without provisioning or managing servers. You package a function, define what triggers it, and AWS handles scaling, patching, and availability. It is the canonical example of "serverless" compute: there are still servers, but you never see or manage them.
How a Lambda function runs
You deploy a handler function in a supported runtime (Node.js, Python, Java, Go, and others) or as a container image. When a trigger fires, Lambda spins up an execution environment, runs your handler, and freezes or tears it down afterward. Concurrency scales automatically as events arrive.
What triggers a function
- HTTP requests via API Gateway or a function URL.
- Events from S3, DynamoDB streams, or SQS and SNS.
- Scheduled invocations on a cron-like timer.
- Direct calls from other services or the AWS SDK.
Cold starts and limits
The first invocation of an idle function pays a cold start while the environment initializes. Functions have a configurable memory size, a maximum timeout, and a deployment package size limit. Keeping packages small and dependencies lean reduces cold-start latency.
Pricing model
You pay per request plus compute time measured in gigabyte-milliseconds, so a function that rarely runs costs almost nothing. This makes Lambda attractive for spiky or event-driven workloads where a constantly running server would be wasteful.
Role in CI/CD
A deploy job zips your function code (or builds a container image), then updates the function with the AWS CLI, SAM, the Serverless Framework, or Terraform. The pipeline authenticates with an IAM role, publishes a new version, and can shift traffic gradually using aliases for safer rollouts. Tests and linting run earlier in CI before the deploy step ever fires.
Key takeaways
- Lambda runs code on demand in response to events, with no servers to manage.
- You pay per request and per millisecond of execution, ideal for spiky workloads.
- Pipelines deploy functions by updating code or images via IAM-authenticated tooling.