sam
AWS Serverless Application Model CLI
TLDR
Initialize a serverless application
$ sam init
Initialize with specific runtime$ sam init --runtime [python3.12]
Build Lambda function code$ sam build
Run serverless application locally$ sam local start-api
Invoke a Lambda function locally$ sam local invoke [FunctionName]
Deploy with guided prompts$ sam deploy --guided
Validate a SAM template$ sam validate
SYNOPSIS
sam command [options]
DESCRIPTION
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.
PARAMETERS
init
Initialize a new serverless applicationbuild
Build Lambda function codedeploy
Deploy application to AWSdelete
Delete a deployed application and its resourcesvalidate
Validate a SAM templatesync
Sync local changes to a deployed applicationlogs
Fetch and display Lambda function logslocal invoke
Invoke a Lambda function locallylocal start-api
Run API Gateway locallylocal start-lambda
Start a local Lambda endpointlocal generate-event
Generate sample event payloads for testing
CAVEATS
Requires AWS credentials configured. Local testing requires Docker. Deployment creates AWS resources that may incur costs.
HISTORY
Developed by AWS to simplify serverless application development and deployment using Infrastructure as Code.
