🇬🇧 English version | 📦 GitHub: https://github.com/geekchow/aws-lambda-guide
你在这里: 本指南包的入口。
读完本文你将知道: 整个知识版图的全貌、指南包的组织方式,以及下一步该读哪个文件。
本指南包从第一性原理讲解 AWS(Amazon Web Services,亚马逊云服务)Lambda:它为什么存在、一次调用在服务内部究竟如何流转,以及版本(Version) 、**别名(Alias)和 预置并发(Provisioned Concurrency)**如何嵌入这幅图景。全篇沿一条主线展开:Why(为什么)→ What(是什么)→ 概念地图 → 贯穿示例 → 组件深入 → 完整走查 ,并由一个贯穿始终的示例串联:网店 ShopFast 的 checkout(结账)函数在黑色星期五那一周的经历。
缩写对照表
| 缩写 | 英文全称 | 中文 | 在本指南中的含义 |
|---|---|---|---|
| AWS | Amazon Web Services | 亚马逊云服务 | 亚马逊的云平台 |
| API | Application Programming Interface | 应用程序编程接口 | 如 Lambda Invoke API、Runtime API |
| ARN | Amazon Resource Name | 亚马逊资源名称 | AWS 资源的全局唯一标识 |
| PC | Provisioned Concurrency | 预置并发 | 预先初始化好的 Lambda 执行环境 |
| RC | Reserved Concurrency | 预留并发 | 函数级并发的下限兼上限 |
| VM | Virtual Machine | 虚拟机 | 隔离的客户机操作系统 |
| microVM | micro Virtual Machine | 微虚拟机 | 极简、快速启动的虚拟机(Firecracker) |
| VMM | Virtual Machine Monitor | 虚拟机监视器 | 管理虚拟机的程序(Firecracker 本身) |
| KVM | Kernel-based Virtual Machine | 基于内核的虚拟机 | Firecracker 使用的 Linux 内核虚拟化 |
| AZ | Availability Zone | 可用区 | Region 内彼此隔离的数据中心组 |
| RPS | Requests Per Second | 每秒请求数 | 请求速率 |
| GB-s | Gigabyte-second | GB 秒 | 计费单位 = 内存(GB)× 时长(秒) |
| IAM | Identity and Access Management | 身份与访问管理 | AWS 权限体系 |
| SQS | Simple Queue Service | 简单队列服务 | AWS 消息队列 |
| SNS | Simple Notification Service | 简单通知服务 | AWS 发布/订阅服务 |
| S3 | Simple Storage Service | 简单存储服务 | AWS 对象存储 |
| ECR | Elastic Container Registry | 弹性容器镜像仓库 | AWS 容器镜像仓库 |
| EC2 | Elastic Compute Cloud | 弹性计算云 | AWS 虚拟服务器 |
| ECS | Elastic Container Service | 弹性容器服务 | AWS 容器编排服务 |
| CLI | Command Line Interface | 命令行接口 | aws 命令 |
| SDK | Software Development Kit | 软件开发工具包 | 各语言的 AWS 客户端库 |
| SAM | Serverless Application Model | 无服务器应用模型 | AWS 的 CloudFormation 无服务器扩展 |
| CDK | Cloud Development Kit | 云开发工具包 | 用通用编程语言写基础设施即代码 |
| CI/CD | Continuous Integration / Continuous Delivery | 持续集成/持续交付 | 自动化构建与部署流水线 |
| ESM | Event Source Mapping | 事件源映射 | Lambda 托管的队列/流轮询器 |
| VPC | Virtual Private Cloud | 虚拟私有云 | AWS 中的私有网络 |
| CPU | Central Processing Unit | 中央处理器 | 算力 |
| HTTP | Hypertext Transfer Protocol | 超文本传输协议 | Web 通信协议 |
| SigV4 | Signature Version 4 | 签名版本 4 | AWS 请求签名算法 |
| PaaS | Platform as a Service | 平台即服务 | 如 Heroku、Elastic Beanstalk |
| p99 | 99th percentile | 第 99 百分位 | 99% 的请求都快于该延迟 |
一图看全貌(必备思维导图)
本图回答:Lambda 有哪些组成部分,它们如何分组?
#mermaid-svg-HGopAMgC5coPPXL5{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-HGopAMgC5coPPXL5 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-HGopAMgC5coPPXL5 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-HGopAMgC5coPPXL5 .error-icon{fill:#552222;}#mermaid-svg-HGopAMgC5coPPXL5 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-HGopAMgC5coPPXL5 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-HGopAMgC5coPPXL5 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-HGopAMgC5coPPXL5 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-HGopAMgC5coPPXL5 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-HGopAMgC5coPPXL5 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-HGopAMgC5coPPXL5 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-HGopAMgC5coPPXL5 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-HGopAMgC5coPPXL5 .marker.cross{stroke:#333333;}#mermaid-svg-HGopAMgC5coPPXL5 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-HGopAMgC5coPPXL5 p{margin:0;}#mermaid-svg-HGopAMgC5coPPXL5 .edge{stroke-width:3;}#mermaid-svg-HGopAMgC5coPPXL5 .section--1 rect,#mermaid-svg-HGopAMgC5coPPXL5 .section--1 path,#mermaid-svg-HGopAMgC5coPPXL5 .section--1 circle,#mermaid-svg-HGopAMgC5coPPXL5 .section--1 polygon,#mermaid-svg-HGopAMgC5coPPXL5 .section--1 path{fill:hsl(240, 100%, 76.2745098039%);}#mermaid-svg-HGopAMgC5coPPXL5 .section--1 text{fill:#ffffff;}#mermaid-svg-HGopAMgC5coPPXL5 .node-icon--1{font-size:40px;color:#ffffff;}#mermaid-svg-HGopAMgC5coPPXL5 .section-edge--1{stroke:hsl(240, 100%, 76.2745098039%);}#mermaid-svg-HGopAMgC5coPPXL5 .edge-depth--1{stroke-width:17;}#mermaid-svg-HGopAMgC5coPPXL5 .section--1 line{stroke:hsl(60, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled,#mermaid-svg-HGopAMgC5coPPXL5 .disabled circle,#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:lightgray;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:#efefef;}#mermaid-svg-HGopAMgC5coPPXL5 .section-0 rect,#mermaid-svg-HGopAMgC5coPPXL5 .section-0 path,#mermaid-svg-HGopAMgC5coPPXL5 .section-0 circle,#mermaid-svg-HGopAMgC5coPPXL5 .section-0 polygon,#mermaid-svg-HGopAMgC5coPPXL5 .section-0 path{fill:hsl(60, 100%, 73.5294117647%);}#mermaid-svg-HGopAMgC5coPPXL5 .section-0 text{fill:black;}#mermaid-svg-HGopAMgC5coPPXL5 .node-icon-0{font-size:40px;color:black;}#mermaid-svg-HGopAMgC5coPPXL5 .section-edge-0{stroke:hsl(60, 100%, 73.5294117647%);}#mermaid-svg-HGopAMgC5coPPXL5 .edge-depth-0{stroke-width:14;}#mermaid-svg-HGopAMgC5coPPXL5 .section-0 line{stroke:hsl(240, 100%, 83.5294117647%);stroke-width:3;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled,#mermaid-svg-HGopAMgC5coPPXL5 .disabled circle,#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:lightgray;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:#efefef;}#mermaid-svg-HGopAMgC5coPPXL5 .section-1 rect,#mermaid-svg-HGopAMgC5coPPXL5 .section-1 path,#mermaid-svg-HGopAMgC5coPPXL5 .section-1 circle,#mermaid-svg-HGopAMgC5coPPXL5 .section-1 polygon,#mermaid-svg-HGopAMgC5coPPXL5 .section-1 path{fill:hsl(80, 100%, 76.2745098039%);}#mermaid-svg-HGopAMgC5coPPXL5 .section-1 text{fill:black;}#mermaid-svg-HGopAMgC5coPPXL5 .node-icon-1{font-size:40px;color:black;}#mermaid-svg-HGopAMgC5coPPXL5 .section-edge-1{stroke:hsl(80, 100%, 76.2745098039%);}#mermaid-svg-HGopAMgC5coPPXL5 .edge-depth-1{stroke-width:11;}#mermaid-svg-HGopAMgC5coPPXL5 .section-1 line{stroke:hsl(260, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled,#mermaid-svg-HGopAMgC5coPPXL5 .disabled circle,#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:lightgray;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:#efefef;}#mermaid-svg-HGopAMgC5coPPXL5 .section-2 rect,#mermaid-svg-HGopAMgC5coPPXL5 .section-2 path,#mermaid-svg-HGopAMgC5coPPXL5 .section-2 circle,#mermaid-svg-HGopAMgC5coPPXL5 .section-2 polygon,#mermaid-svg-HGopAMgC5coPPXL5 .section-2 path{fill:hsl(270, 100%, 76.2745098039%);}#mermaid-svg-HGopAMgC5coPPXL5 .section-2 text{fill:#ffffff;}#mermaid-svg-HGopAMgC5coPPXL5 .node-icon-2{font-size:40px;color:#ffffff;}#mermaid-svg-HGopAMgC5coPPXL5 .section-edge-2{stroke:hsl(270, 100%, 76.2745098039%);}#mermaid-svg-HGopAMgC5coPPXL5 .edge-depth-2{stroke-width:8;}#mermaid-svg-HGopAMgC5coPPXL5 .section-2 line{stroke:hsl(90, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled,#mermaid-svg-HGopAMgC5coPPXL5 .disabled circle,#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:lightgray;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:#efefef;}#mermaid-svg-HGopAMgC5coPPXL5 .section-3 rect,#mermaid-svg-HGopAMgC5coPPXL5 .section-3 path,#mermaid-svg-HGopAMgC5coPPXL5 .section-3 circle,#mermaid-svg-HGopAMgC5coPPXL5 .section-3 polygon,#mermaid-svg-HGopAMgC5coPPXL5 .section-3 path{fill:hsl(300, 100%, 76.2745098039%);}#mermaid-svg-HGopAMgC5coPPXL5 .section-3 text{fill:black;}#mermaid-svg-HGopAMgC5coPPXL5 .node-icon-3{font-size:40px;color:black;}#mermaid-svg-HGopAMgC5coPPXL5 .section-edge-3{stroke:hsl(300, 100%, 76.2745098039%);}#mermaid-svg-HGopAMgC5coPPXL5 .edge-depth-3{stroke-width:5;}#mermaid-svg-HGopAMgC5coPPXL5 .section-3 line{stroke:hsl(120, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled,#mermaid-svg-HGopAMgC5coPPXL5 .disabled circle,#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:lightgray;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:#efefef;}#mermaid-svg-HGopAMgC5coPPXL5 .section-4 rect,#mermaid-svg-HGopAMgC5coPPXL5 .section-4 path,#mermaid-svg-HGopAMgC5coPPXL5 .section-4 circle,#mermaid-svg-HGopAMgC5coPPXL5 .section-4 polygon,#mermaid-svg-HGopAMgC5coPPXL5 .section-4 path{fill:hsl(330, 100%, 76.2745098039%);}#mermaid-svg-HGopAMgC5coPPXL5 .section-4 text{fill:black;}#mermaid-svg-HGopAMgC5coPPXL5 .node-icon-4{font-size:40px;color:black;}#mermaid-svg-HGopAMgC5coPPXL5 .section-edge-4{stroke:hsl(330, 100%, 76.2745098039%);}#mermaid-svg-HGopAMgC5coPPXL5 .edge-depth-4{stroke-width:2;}#mermaid-svg-HGopAMgC5coPPXL5 .section-4 line{stroke:hsl(150, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled,#mermaid-svg-HGopAMgC5coPPXL5 .disabled circle,#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:lightgray;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:#efefef;}#mermaid-svg-HGopAMgC5coPPXL5 .section-5 rect,#mermaid-svg-HGopAMgC5coPPXL5 .section-5 path,#mermaid-svg-HGopAMgC5coPPXL5 .section-5 circle,#mermaid-svg-HGopAMgC5coPPXL5 .section-5 polygon,#mermaid-svg-HGopAMgC5coPPXL5 .section-5 path{fill:hsl(0, 100%, 76.2745098039%);}#mermaid-svg-HGopAMgC5coPPXL5 .section-5 text{fill:black;}#mermaid-svg-HGopAMgC5coPPXL5 .node-icon-5{font-size:40px;color:black;}#mermaid-svg-HGopAMgC5coPPXL5 .section-edge-5{stroke:hsl(0, 100%, 76.2745098039%);}#mermaid-svg-HGopAMgC5coPPXL5 .edge-depth-5{stroke-width:-1;}#mermaid-svg-HGopAMgC5coPPXL5 .section-5 line{stroke:hsl(180, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled,#mermaid-svg-HGopAMgC5coPPXL5 .disabled circle,#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:lightgray;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:#efefef;}#mermaid-svg-HGopAMgC5coPPXL5 .section-6 rect,#mermaid-svg-HGopAMgC5coPPXL5 .section-6 path,#mermaid-svg-HGopAMgC5coPPXL5 .section-6 circle,#mermaid-svg-HGopAMgC5coPPXL5 .section-6 polygon,#mermaid-svg-HGopAMgC5coPPXL5 .section-6 path{fill:hsl(30, 100%, 76.2745098039%);}#mermaid-svg-HGopAMgC5coPPXL5 .section-6 text{fill:black;}#mermaid-svg-HGopAMgC5coPPXL5 .node-icon-6{font-size:40px;color:black;}#mermaid-svg-HGopAMgC5coPPXL5 .section-edge-6{stroke:hsl(30, 100%, 76.2745098039%);}#mermaid-svg-HGopAMgC5coPPXL5 .edge-depth-6{stroke-width:-4;}#mermaid-svg-HGopAMgC5coPPXL5 .section-6 line{stroke:hsl(210, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled,#mermaid-svg-HGopAMgC5coPPXL5 .disabled circle,#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:lightgray;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:#efefef;}#mermaid-svg-HGopAMgC5coPPXL5 .section-7 rect,#mermaid-svg-HGopAMgC5coPPXL5 .section-7 path,#mermaid-svg-HGopAMgC5coPPXL5 .section-7 circle,#mermaid-svg-HGopAMgC5coPPXL5 .section-7 polygon,#mermaid-svg-HGopAMgC5coPPXL5 .section-7 path{fill:hsl(90, 100%, 76.2745098039%);}#mermaid-svg-HGopAMgC5coPPXL5 .section-7 text{fill:black;}#mermaid-svg-HGopAMgC5coPPXL5 .node-icon-7{font-size:40px;color:black;}#mermaid-svg-HGopAMgC5coPPXL5 .section-edge-7{stroke:hsl(90, 100%, 76.2745098039%);}#mermaid-svg-HGopAMgC5coPPXL5 .edge-depth-7{stroke-width:-7;}#mermaid-svg-HGopAMgC5coPPXL5 .section-7 line{stroke:hsl(270, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled,#mermaid-svg-HGopAMgC5coPPXL5 .disabled circle,#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:lightgray;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:#efefef;}#mermaid-svg-HGopAMgC5coPPXL5 .section-8 rect,#mermaid-svg-HGopAMgC5coPPXL5 .section-8 path,#mermaid-svg-HGopAMgC5coPPXL5 .section-8 circle,#mermaid-svg-HGopAMgC5coPPXL5 .section-8 polygon,#mermaid-svg-HGopAMgC5coPPXL5 .section-8 path{fill:hsl(150, 100%, 76.2745098039%);}#mermaid-svg-HGopAMgC5coPPXL5 .section-8 text{fill:black;}#mermaid-svg-HGopAMgC5coPPXL5 .node-icon-8{font-size:40px;color:black;}#mermaid-svg-HGopAMgC5coPPXL5 .section-edge-8{stroke:hsl(150, 100%, 76.2745098039%);}#mermaid-svg-HGopAMgC5coPPXL5 .edge-depth-8{stroke-width:-10;}#mermaid-svg-HGopAMgC5coPPXL5 .section-8 line{stroke:hsl(330, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled,#mermaid-svg-HGopAMgC5coPPXL5 .disabled circle,#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:lightgray;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:#efefef;}#mermaid-svg-HGopAMgC5coPPXL5 .section-9 rect,#mermaid-svg-HGopAMgC5coPPXL5 .section-9 path,#mermaid-svg-HGopAMgC5coPPXL5 .section-9 circle,#mermaid-svg-HGopAMgC5coPPXL5 .section-9 polygon,#mermaid-svg-HGopAMgC5coPPXL5 .section-9 path{fill:hsl(180, 100%, 76.2745098039%);}#mermaid-svg-HGopAMgC5coPPXL5 .section-9 text{fill:black;}#mermaid-svg-HGopAMgC5coPPXL5 .node-icon-9{font-size:40px;color:black;}#mermaid-svg-HGopAMgC5coPPXL5 .section-edge-9{stroke:hsl(180, 100%, 76.2745098039%);}#mermaid-svg-HGopAMgC5coPPXL5 .edge-depth-9{stroke-width:-13;}#mermaid-svg-HGopAMgC5coPPXL5 .section-9 line{stroke:hsl(0, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled,#mermaid-svg-HGopAMgC5coPPXL5 .disabled circle,#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:lightgray;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:#efefef;}#mermaid-svg-HGopAMgC5coPPXL5 .section-10 rect,#mermaid-svg-HGopAMgC5coPPXL5 .section-10 path,#mermaid-svg-HGopAMgC5coPPXL5 .section-10 circle,#mermaid-svg-HGopAMgC5coPPXL5 .section-10 polygon,#mermaid-svg-HGopAMgC5coPPXL5 .section-10 path{fill:hsl(210, 100%, 76.2745098039%);}#mermaid-svg-HGopAMgC5coPPXL5 .section-10 text{fill:black;}#mermaid-svg-HGopAMgC5coPPXL5 .node-icon-10{font-size:40px;color:black;}#mermaid-svg-HGopAMgC5coPPXL5 .section-edge-10{stroke:hsl(210, 100%, 76.2745098039%);}#mermaid-svg-HGopAMgC5coPPXL5 .edge-depth-10{stroke-width:-16;}#mermaid-svg-HGopAMgC5coPPXL5 .section-10 line{stroke:hsl(30, 100%, 86.2745098039%);stroke-width:3;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled,#mermaid-svg-HGopAMgC5coPPXL5 .disabled circle,#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:lightgray;}#mermaid-svg-HGopAMgC5coPPXL5 .disabled text{fill:#efefef;}#mermaid-svg-HGopAMgC5coPPXL5 .section-root rect,#mermaid-svg-HGopAMgC5coPPXL5 .section-root path,#mermaid-svg-HGopAMgC5coPPXL5 .section-root circle,#mermaid-svg-HGopAMgC5coPPXL5 .section-root polygon{fill:hsl(240, 100%, 46.2745098039%);}#mermaid-svg-HGopAMgC5coPPXL5 .section-root text{fill:#ffffff;}#mermaid-svg-HGopAMgC5coPPXL5 .section-root span{color:#ffffff;}#mermaid-svg-HGopAMgC5coPPXL5 .section-2 span{color:#ffffff;}#mermaid-svg-HGopAMgC5coPPXL5 .icon-container{height:100%;display:flex;justify-content:center;align-items:center;}#mermaid-svg-HGopAMgC5coPPXL5 .edge{fill:none;}#mermaid-svg-HGopAMgC5coPPXL5 .mindmap-node-label{dy:1em;alignment-baseline:middle;text-anchor:middle;dominant-baseline:middle;text-align:center;}#mermaid-svg-HGopAMgC5coPPXL5 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} AWS Lambda
要解决的问题
闲置服务器也要付费
容量规划靠猜
打补丁与扩缩容的苦活
原地部署风险高
核心概念
函数 Function
执行环境
调用与并发
版本: 不可变快照
别名: 可移动指针
预置并发 PC
派生: 冷启动
派生: 预留并发
关键组件
版本存储
负责不可变快照
别名路由
负责限定符到版本
PC 管理器与自动扩缩
负责预热池大小
调用前端与计数服务
负责准入与限额
分配与放置服务
负责找到或创建环境
执行环境
负责运行你的代码
贯穿示例
ShopFast 黑五结账
v8 经 prod 别名
金丝雀发布
09:00 开售前预热 PC 400
关键流程
热调用正常路径
冷启动溢出
达上限时 429 限流
切换别名回滚
连接数先于容量耗尽
指南包的组织方式
#mermaid-svg-0gj6MnkcwtquFHni{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-0gj6MnkcwtquFHni .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-0gj6MnkcwtquFHni .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-0gj6MnkcwtquFHni .error-icon{fill:#552222;}#mermaid-svg-0gj6MnkcwtquFHni .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-0gj6MnkcwtquFHni .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-0gj6MnkcwtquFHni .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-0gj6MnkcwtquFHni .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-0gj6MnkcwtquFHni .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-0gj6MnkcwtquFHni .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-0gj6MnkcwtquFHni .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-0gj6MnkcwtquFHni .marker{fill:#333333;stroke:#333333;}#mermaid-svg-0gj6MnkcwtquFHni .marker.cross{stroke:#333333;}#mermaid-svg-0gj6MnkcwtquFHni svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-0gj6MnkcwtquFHni p{margin:0;}#mermaid-svg-0gj6MnkcwtquFHni .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-0gj6MnkcwtquFHni .cluster-label text{fill:#333;}#mermaid-svg-0gj6MnkcwtquFHni .cluster-label span{color:#333;}#mermaid-svg-0gj6MnkcwtquFHni .cluster-label span p{background-color:transparent;}#mermaid-svg-0gj6MnkcwtquFHni .label text,#mermaid-svg-0gj6MnkcwtquFHni span{fill:#333;color:#333;}#mermaid-svg-0gj6MnkcwtquFHni .node rect,#mermaid-svg-0gj6MnkcwtquFHni .node circle,#mermaid-svg-0gj6MnkcwtquFHni .node ellipse,#mermaid-svg-0gj6MnkcwtquFHni .node polygon,#mermaid-svg-0gj6MnkcwtquFHni .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-0gj6MnkcwtquFHni .rough-node .label text,#mermaid-svg-0gj6MnkcwtquFHni .node .label text,#mermaid-svg-0gj6MnkcwtquFHni .image-shape .label,#mermaid-svg-0gj6MnkcwtquFHni .icon-shape .label{text-anchor:middle;}#mermaid-svg-0gj6MnkcwtquFHni .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-0gj6MnkcwtquFHni .rough-node .label,#mermaid-svg-0gj6MnkcwtquFHni .node .label,#mermaid-svg-0gj6MnkcwtquFHni .image-shape .label,#mermaid-svg-0gj6MnkcwtquFHni .icon-shape .label{text-align:center;}#mermaid-svg-0gj6MnkcwtquFHni .node.clickable{cursor:pointer;}#mermaid-svg-0gj6MnkcwtquFHni .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-0gj6MnkcwtquFHni .arrowheadPath{fill:#333333;}#mermaid-svg-0gj6MnkcwtquFHni .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-0gj6MnkcwtquFHni .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-0gj6MnkcwtquFHni .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-0gj6MnkcwtquFHni .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-0gj6MnkcwtquFHni .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-0gj6MnkcwtquFHni .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-0gj6MnkcwtquFHni .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-0gj6MnkcwtquFHni .cluster text{fill:#333;}#mermaid-svg-0gj6MnkcwtquFHni .cluster span{color:#333;}#mermaid-svg-0gj6MnkcwtquFHni div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-0gj6MnkcwtquFHni .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-0gj6MnkcwtquFHni rect.text{fill:none;stroke-width:0;}#mermaid-svg-0gj6MnkcwtquFHni .icon-shape,#mermaid-svg-0gj6MnkcwtquFHni .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-0gj6MnkcwtquFHni .icon-shape p,#mermaid-svg-0gj6MnkcwtquFHni .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-0gj6MnkcwtquFHni .icon-shape .label rect,#mermaid-svg-0gj6MnkcwtquFHni .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-0gj6MnkcwtquFHni .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-0gj6MnkcwtquFHni .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-0gj6MnkcwtquFHni :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 01 为什么
02 是什么
03 概念地图
04 贯穿示例
05.1 版本
05.2 别名
05.3 预置并发
05.4 调用前端
与计数服务
05.5 分配与
放置服务
05.6 执行环境
05.7 受连接数
约束的后端
06 完整走查
07 后续练习
图注:阅读顺序------先广度(01--04),再按示例中出场顺序对每个关键组件深入(05.1--05.6),外加受连接数约束的后端(05.7),最后完整重放(06)。
| # | 文件 | 阶段 | 你将获得 |
|---|---|---|---|
| 01 | 01 为什么 | 为什么 | 服务器、容量规划与原地部署之痛 |
| 02 | 02 是什么 | 是什么 | 一句话定义、边界、生态位置 |
| 03 | 03 概念地图 | 概念地图 | 6 个核心概念、6 个关键组件、协作总图 |
| 04 | 04 贯穿示例 | 贯穿示例 | ShopFast checkout 黑五一周,浅层追踪 |
| 05.1 | 05.1 版本 | 深入 | 不可变快照、$LATEST、限定 ARN |
| 05.2 | 05.2 别名 | 深入 | 指针、加权路由、金丝雀与回滚 |
| 05.3 | 05.3 预置并发 | 深入 | 预热池、溢出、自动扩缩、成本 |
| 05.4 | 05.4 调用前端与并发 | 深入 | 准入、并发计算、预留并发、限流 |
| 05.5 | 05.5 分配与放置 | 深入 | 找到热环境或新建环境 |
| 05.6 | 05.6 执行环境 | 深入 | Firecracker 微虚拟机、Init/Invoke/Shutdown、冻结/解冻 |
| 05.7 | 05.7 受连接数约束的后端 | 深入 | CloudHSM/数据库连接为何先耗尽;RDS Proxy、KMS 密钥存储、服务层 |
| 06 | 06 完整走查 | 走查 | 示例端到端的完整深度重放 |
| 07 | 07 自测与实验 | 练习 | 自测题、动手实验脚本、延伸阅读 |
配套图源:diagrams/lambda-architecture.drawio ------ 包含控制面与数据面的泳道全景图(用 draw.io / diagrams.net 打开)。
关于内部实现的说明。 Frontend Invoke service(调用前端) 、Counting service(计数服务) 、Assignment service(分配服务)、*Placement service(放置服务)*等名称来自 AWS 公开的架构演讲(re:Invent "A closer look at AWS Lambda" 系列)和 Firecracker 论文。它们是可靠的心智模型,但不是公开的 API 契约,AWS 会持续演进。你能配置的一切(版本、别名、PC(Provisioned Concurrency,预置并发)、预留并发)都是公开且有文档的 API。
下一篇 → 01 为什么