3.2
Lambda (incl. EC2 vs Lambda)
Run code without managing servers; ideal for event-driven, short-lived work.
Key points
- Use cases: events, APIs, S3 triggers, automation.
- Lambda: AWS manages infrastructure; you manage code and config.
- EC2 for long-running; Lambda for event-driven.
AWS Lambda
Lambda is a serverless compute service. You can run code without managing traditional servers.
Typical use cases
- Event processing
- APIs
- S3 events
- Automation
- Backend functions
EC2 vs Lambda
| EC2 | Lambda |
|---|---|
| Virtual server | Serverless function |
| More infrastructure control | Less infrastructure management |
| Suitable for long-running workloads | Commonly used for event-driven workloads |
| Customer manages the OS | AWS manages the underlying infrastructure |
Exam focus
Serverless / function / no server management → Lambda.