1.2 KiB
1.2 KiB
title, type, tags, date
| title | type | tags | date | ||||
|---|---|---|---|---|---|---|---|
| Serverless Application Model | concept |
|
2024-09-03 |
Definition
Serverless Application Model(无服务器应用模型,SAM)是 AWS 提供的开源框架,用于简化无服务器应用的本地开发和部署。基于 CloudFormation,扩展了声明无服务器资源的简化的语法。
Key Features
- SAM CLI:
sam init:初始化项目sam build:本地构建sam local:本地运行和调试sam deploy:部署到 AWS
- 模板简化:相比 CloudFormation 更简洁的语法
- 本地测试:支持本地调用 Lambda 和 Step Functions
SAM Template Structure
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-08-09
Resources:
MyFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs18.x
Events:
Api:
Type: Api
Properties:
Path: /hello
Method: get
Common Use Cases
- Lambda 函数部署
- API Gateway 集成
- Step Functions 工作流
- 事件驱动架构
Aliases
- AWS SAM
- SAM
- Serverless Application Model