← 返回命令列表

Linux command

sam 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Initialize

sam init

Example

sam init --runtime [python3.12]

Build

sam build

Example

sam local start-api

Invoke

sam local invoke [FunctionName]

Deploy

sam deploy --guided

Validate

sam validate

说明

sam is the AWS Serverless Application Model CLI. It provides tools for building, testing, and deploying serverless applications using AWS Lambda, API Gateway, and other AWS services. The CLI supports local development and testing before cloud deployment.

参数

init
Initialize a new serverless application
build
Build Lambda function code
deploy
Deploy application to AWS
delete
Delete a deployed application and its resources
validate
Validate a SAM template
sync
Sync local changes to a deployed application
logs
Fetch and display Lambda function logs
local invoke
Invoke a Lambda function locally
local start-api
Run API Gateway locally
local start-lambda
Start a local Lambda endpoint
local generate-event
Generate sample event payloads for testing

FAQ

What is the sam command used for?

sam is the AWS Serverless Application Model CLI. It provides tools for building, testing, and deploying serverless applications using AWS Lambda, API Gateway, and other AWS services. The CLI supports local development and testing before cloud deployment.

How do I run a basic sam example?

Run `sam init` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does init do in sam?

Initialize a new serverless application