Sync: add infrastructure as code notes

This commit is contained in:
2026-04-24 19:58:02 +08:00
parent cc23df1883
commit e4f6f463cb
29 changed files with 2344 additions and 155 deletions

View File

@@ -1,76 +1,70 @@
---
title: "Serverless Computing"
type: concept
tags: [Cloud, Serverless, Cloud Native, Edge Computing]
date: 2026-04-26
tags:
- Cloud
- Serverless
- AWS
- DevOps
sources:
- public-cloud-learning-sessions-opentext-serverless-computing-20240903-160139-mee
last_updated: 2026-04-14
---
# Serverless Computing (无服务器计算)
## Definition
**Serverless Computing** is a cloud execution model where the cloud provider dynamically manages the allocation and provisioning of servers. Developers can build and deploy applications without worrying about infrastructure management.
## Key Characteristics
- **No server management**: Cloud provider handles infrastructure
- **Automatic scaling**: Resources scale based on demand
- **Pay-per-use**: Pay only for execution time
- **Event-driven**: Functions respond to events/triggers
Serverless Computing无服务器计算是一种云原生执行模型在该模式下云厂商承担底层基础设施的全部运维责任负载均衡、自动扩展、安全补丁、容量管理开发者只需专注编写业务逻辑代码。Serverless 并非"无服务器",而是将服务器管理抽象给云厂商。
## Key Platforms
## Core Characteristics
| Provider | Service |
|----------|---------|
| AWS | Lambda |
| Azure | Azure Functions |
| GCP | Cloud Functions |
| 特性 | 描述 |
|------|------|
| 无运维 | 云厂商管理服务器操作系统、运行时和安全补丁 |
| 事件驱动 | 函数由事件触发,事件即资源状态的任何变化 |
| 按需付费 | 仅在函数执行时计费(按调用次数和执行时长) |
| 自动扩展 | 云厂商根据请求量自动水平扩展,无需人工干预 |
| 内置安全 | 云厂商提供基础安全能力网络隔离、IAM 权限控制) |
## Benefits
## Business Value
### 1. Cost Efficiency
- Eliminates unnecessary resource consumption
- No idle capacity costs
- Pay only for actual execution time
企业采用 Serverless 的核心驱动因素:
- **更快上市时间**Faster Time to Market开发团队专注业务逻辑无需管理基础设施
- **业务聚焦**Business Focus将非核心运维任务外包给云厂商
- **更低 TCO**Total Cost of Ownership按需付费空闲时零成本
- **弹性扩展**Elastic Scalability从零到百万并发自动应对
- **内置安全**Built-in Security云厂商持续更新安全补丁
### 2. Scalability
- Automatic scaling from zero to thousands of instances
- Handles traffic spikes without provisioning
- Global distribution ready
## AWS Serverless Ecosystem
### 3. Developer Productivity
- Focus on business logic, not infrastructure
- Faster deployment cycles
- Reduced operational overhead
AWS 提供完整的 Serverless 服务矩阵:
## Use Cases
| 服务 | 作用 | 关系 |
|------|------|------|
| [[AWS-Lambda]] | 无服务器计算核心 | 函数执行层 |
| [[Amazon-API-Gateway]] | API 创建、发布、安全 | API 暴露层 |
| [[AWS-Step-Functions]] | 工作流编排 | 流程编排层 |
| [[Amazon-EventBridge]] | 事件总线 | 事件路由层 |
| [[AWS-Fargate]] | 无服务器容器 | 容器层的 Serverless |
| [[Amazon-DynamoDB]] | 无服务器数据库 | 数据持久层 |
| [[SAM-Serverless-Application-Model]] | 本地开发和部署工具 | 开发工具层 |
### Event-Driven Automation
- Real-time file processing
- Automated backups
- Scheduled tasks and cron jobs
## Shared Responsibility Model
### API Backends
- Microservices architecture
- Real-time data processing
- IoT data ingestion
在 Serverless 环境中AWS 与客户共担运维责任:
### AI/ML Inference
- On-demand model inference
- Image and video processing
- Natural language processing
- **AWS 负责**:基础设施、服务器硬件、网络、运行时环境、安全补丁、负载均衡、自动扩展
- **客户负责**业务代码、依赖管理、权限配置IAM、应用程序级别的安全
## Relationship to Green Computing
- Serverless computing contributes to [[Green Computing]] by:
- Eliminating idle resource consumption
- Optimizing energy efficiency through shared infrastructure
- Reducing data center carbon footprint
## Event-Driven Architecture Connection
Serverless 天然契合 [[Event-Driven-Architecture]] 模式:
1. **事件源**Event SourceS3、API Gateway、EventBridge、DynamoDB Stream 等
2. **事件路由器**Event RouterEventBridge、SNS 等筛选和路由事件
3. **Lambda 函数**Function消费事件执行业务逻辑
4. **下游服务**DownstreamDynamoDB、SQS、SNS 等处理结果
## Related Concepts
- [[Cloud-Native]]
- [[Green Computing]]
- [[Event-Driven-Architecture]]
- [[Edge-Computing]]
## Related Entities
- [[AWS Lambda]]
- [[Azure Functions]]
- [[Google Cloud Functions]]
- [[Event-Driven-Architecture]] — Serverless 的天然执行模型
- [[Lambda-Permissions-Model]] — Serverless 函数的安全权限模型
- [[Cloud-Transformation-Programme]] — Serverless 是云转型的关键技术路径之一