AWS Lambda 是一个无服务器计算服务 — 你无需管理服务器就能运行代码(函数)。AWS 自动配置、扩展和管理基础设施;你只需提供代码,它便会响应事件运行,你仅需为使用的计算时间付费。
无服务器:无需管理服务器
SERVERLESS doesn't mean "no servers" — it means YOU don't manage them:
→ you provide CODE (a function); AWS runs it on demand
→ AWS handles provisioning, SCALING (automatically, to any load), patching, availability
→ pay ONLY for actual execution time (not idle servers) — no cost when not running
→ Focus purely on code, not infrastructure.
Lambda 如何工作
→ You write a FUNCTION (in Node.js, Python, Java, Go, etc.)
→ It runs in response to EVENTS (triggers):
- HTTP requests (via API Gateway) → build APIs/backends
- file uploaded to S3 → process it
- message in a queue (SQS) → handle it
- scheduled (cron) → run periodically
- database changes, and many more
→ AWS runs the function, scales automatically (1 to thousands of concurrent executions)
