71 lines
3.2 KiB
Markdown
71 lines
3.2 KiB
Markdown
---
|
||
title: "Serverless Computing"
|
||
type: concept
|
||
tags:
|
||
- Cloud
|
||
- Serverless
|
||
- AWS
|
||
- DevOps
|
||
sources:
|
||
- public-cloud-learning-sessions-opentext-serverless-computing-20240903-160139-mee
|
||
last_updated: 2026-04-14
|
||
---
|
||
|
||
## Definition
|
||
|
||
Serverless Computing(无服务器计算)是一种云原生执行模型,在该模式下,云厂商承担底层基础设施的全部运维责任(负载均衡、自动扩展、安全补丁、容量管理),开发者只需专注编写业务逻辑代码。Serverless 并非"无服务器",而是将服务器管理抽象给云厂商。
|
||
|
||
## Core Characteristics
|
||
|
||
| 特性 | 描述 |
|
||
|------|------|
|
||
| 无运维 | 云厂商管理服务器操作系统、运行时和安全补丁 |
|
||
| 事件驱动 | 函数由事件触发,事件即资源状态的任何变化 |
|
||
| 按需付费 | 仅在函数执行时计费(按调用次数和执行时长) |
|
||
| 自动扩展 | 云厂商根据请求量自动水平扩展,无需人工干预 |
|
||
| 内置安全 | 云厂商提供基础安全能力(网络隔离、IAM 权限控制) |
|
||
|
||
## Business Value
|
||
|
||
企业采用 Serverless 的核心驱动因素:
|
||
- **更快上市时间**(Faster Time to Market):开发团队专注业务逻辑,无需管理基础设施
|
||
- **业务聚焦**(Business Focus):将非核心运维任务外包给云厂商
|
||
- **更低 TCO**(Total Cost of Ownership):按需付费,空闲时零成本
|
||
- **弹性扩展**(Elastic Scalability):从零到百万并发自动应对
|
||
- **内置安全**(Built-in Security):云厂商持续更新安全补丁
|
||
|
||
## AWS Serverless Ecosystem
|
||
|
||
AWS 提供完整的 Serverless 服务矩阵:
|
||
|
||
| 服务 | 作用 | 关系 |
|
||
|------|------|------|
|
||
| [[AWS-Lambda]] | 无服务器计算核心 | 函数执行层 |
|
||
| [[Amazon-API-Gateway]] | API 创建、发布、安全 | API 暴露层 |
|
||
| [[AWS-Step-Functions]] | 工作流编排 | 流程编排层 |
|
||
| [[Amazon-EventBridge]] | 事件总线 | 事件路由层 |
|
||
| [[AWS-Fargate]] | 无服务器容器 | 容器层的 Serverless |
|
||
| [[Amazon-DynamoDB]] | 无服务器数据库 | 数据持久层 |
|
||
| [[SAM-Serverless-Application-Model]] | 本地开发和部署工具 | 开发工具层 |
|
||
|
||
## Shared Responsibility Model
|
||
|
||
在 Serverless 环境中,AWS 与客户共担运维责任:
|
||
|
||
- **AWS 负责**:基础设施、服务器硬件、网络、运行时环境、安全补丁、负载均衡、自动扩展
|
||
- **客户负责**:业务代码、依赖管理、权限配置(IAM)、应用程序级别的安全
|
||
|
||
## Event-Driven Architecture Connection
|
||
|
||
Serverless 天然契合 [[Event-Driven-Architecture]] 模式:
|
||
|
||
1. **事件源**(Event Source):S3、API Gateway、EventBridge、DynamoDB Stream 等
|
||
2. **事件路由器**(Event Router):EventBridge、SNS 等筛选和路由事件
|
||
3. **Lambda 函数**(Function):消费事件,执行业务逻辑
|
||
4. **下游服务**(Downstream):DynamoDB、SQS、SNS 等处理结果
|
||
|
||
## Related Concepts
|
||
- [[Event-Driven-Architecture]] — Serverless 的天然执行模型
|
||
- [[Lambda-Permissions-Model]] — Serverless 函数的安全权限模型
|
||
- [[Cloud-Transformation-Programme]] — Serverless 是云转型的关键技术路径之一
|