AWS Lambda
Lambda
You need to execute backend code in response to events without provisioning, patching, or managing any virtual servers.
Reach for it when
- Processing incoming files uploaded to S3 buckets by resizing images or parsing CSV data.
- Running backend API logic behind API Gateway that scales instantly from zero to thousands of concurrent users.
- Executing scheduled cron tasks or cleanup scripts triggered by EventBridge rules.
Do not reach for it when
- Running workloads that require execution times longer than 15 minutes — use ECS Fargate or Step Functions instead.
- Hosting legacy applications that require standard POSIX filesystems or custom kernel configurations — use EC2 instead.
- Processing continuous, high-volume websocket connections with low latency requirements — use ECS or API Gateway WebSocket API instead.
Alternatives, and how to choose
| Service | Pick it instead when |
|---|---|
| ECS Fargate | Choose it when your application runs as a standard container with no execution time limits. |
| App Runner | Choose it when deploying a standard web application directly from source code or a container registry. |
How you pay
- The model
- Pay per execution request and per millisecond of compute time allocated, based on provisioned memory.
- The line item that surprises people
- Provisioning high memory limits or enabling provisioned concurrency to avoid cold starts accumulates high monthly idle fees.
What trips people up
- Cold starts can add seconds of latency to the first request if a function has not been invoked recently.
- The temp disk space in the runtime environment is ephemeral; do not store data there across separate invocations.
- Connecting a Lambda function to a private VPC subnet dramatically increases cold start times due to ENI creation delays.
Verify the live service
This page is a concept reference. Cost models are qualitative; confirm the current offering, Region and pricing before deploying.