Compute
AWS Lambda
Event-driven serverless functions
AWS Lambda runs code in response to events with no servers to manage. Billing is per request plus duration (GB-seconds). Functions scale automatically to thousands of concurrent executions and integrate natively with S3, DynamoDB, SQS, API Gateway, EventBridge, and more.
When to use it
- Event-driven processing (S3 uploads, stream records, queue messages)
- APIs and glue logic with variable or sparse traffic
- Scheduled tasks and automation
- Workloads that fit within the 15-minute execution limit
When NOT to use it
- Long-running jobs over 15 minutes (use ECS/Fargate or Batch)
- Workloads needing kernel modules or full OS control (use EC2)
- Ultra-latency-critical paths where cold starts are unacceptable (consider provisioned concurrency or EC2)
Key exam points
- 15-minute maximum execution time
- Auto-scaling concurrency; throttling when concurrency limits are hit
- Execution role = IAM role the function assumes; grant least privilege
- Pay per request + GB-second — cheapest for intermittent workloads
Compared with
- Amazon EC2 — EC2 gives full OS control and predictable steady-state performance; Lambda gives zero-ops, scale-to-zero event compute.
- Amazon SQS — Pair SQS queues with Lambda for buffered, retryable event processing.