aws sam
2
总安装量
0
周安装量
#67317
全站排名
安装命令
npx skills add https://github.com/shotaiuchi/dotclaude --skill AWS SAM
Skill 文档
AWS SAM (Serverless Application Model)
AWS SAM is an IaC framework for building serverless applications.
Core Principles
- Infrastructure as Code (IaC) – Manage all resources in template.yaml
- Single Responsibility Function Design – Each Lambda focuses on one function
- Principle of Least Privilege – IAM policies should be minimal
- Local-First Development – Test with sam local before deploying
Architecture
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â API Gateway â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â
â¼
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â Lambda Functions â
â ââââââââââââââââ ââââââââââââââââ ââââââââââââââââ â
â â Function A â â Function B â â Function C â â
â ââââââââââââââââ ââââââââââââââââ ââââââââââââââââ â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â
ââââââââââââââââââââ¼âââââââââââââââââââ
â¼ â¼ â¼
ââââââââââââââ ââââââââââââââ ââââââââââââââ
â DynamoDB â â S3 â â SQS â
ââââââââââââââ ââââââââââââââ ââââââââââââââ
SAM CLI Commands
| Command | Purpose |
|---|---|
sam init |
Create new project |
sam build |
Build (resolve dependencies) |
sam deploy --guided |
Initial deployment (interactive) |
sam local invoke |
Run function locally |
sam local start-api |
Start local API server |
sam sync --watch |
Auto-sync changes (during development) |
sam logs -t |
Tail CloudWatch logs |
sam delete |
Delete deployed stack and resources |
Directory Structure
project/
âââ template.yaml # SAM template
âââ samconfig.toml # Deployment configuration
âââ functions/
â âââ function_a/
â â âââ app.py # Handler
â â âââ requirements.txt
â âââ function_b/
â âââ index.js
â âââ package.json
âââ layers/
â âââ shared/
â âââ python/
âââ events/ # Test events (use `sam local generate-event` to create)
â âââ event.json # Generated via: sam local generate-event apigateway aws-proxy
âââ tests/
âââ unit/