AWS SAM CLI (Serverless Application Model Command Line Interface) is an open-source command-line tool that makes it easy to build, test, and deploy serverless applications on AWS. It provides a set of commands to package and deploy serverless applications, and also includes a local development environment for testing your applications locally before deploying them to AWS.
The AWS Serverless Application Model (SAM) CLI is an open-source CLI tool that helps you develop serverless applications containing Lambda functions, Step Functions, API Gateway, EventBridge, SQS, SNS and more.
The SAM CLI uses AWS CloudFormation to define the infrastructure and resources required by your serverless application, and then deploys and manages those resources on your behalf. It supports a variety of programming languages and frameworks, including Node.js, Python, Java, and .NET Core, among others. The SAM CLI can be used as a standalone tool or in conjunction with other AWS services and tools, such as the AWS CLI and AWS CloudFormation Designer.
Some of the features it provides are:
- Initialize serverless applications in minutes with AWS-provided infrastructure templates with
sam init
- Compile, build, and package Lambda functions with provided runtimes and with custom Makefile workflows, for zip and image types of Lambda functions with
sam build
- Locally test a Lambda function and API Gateway easily in a Docker container with
sam local
commands on SAM and CDK applications - Sync and test your changes in the cloud with
sam sync
in your developer environments - Deploy your SAM and CloudFormation templates using
sam deploy
- Quickly create pipelines with prebuilt templates with popular CI/CD systems using
sam pipeline init
- Tail CloudWatch logs and X-Ray traces with
sam logs
andsam traces
SAM workflow
How to install AWS SAM in linux?
- Download the AWS SAM CLI .zip file to a directory of your choice.
- Verify the integrity and authenticity of the downloaded installer files by generating a hash value using the following command:
$ sha256sum aws-sam-cli-linux-x86_64.zip
The output should look like the following example: <64-character SHA256 hash value> aws-sam-cli-linux-x86_64.zipCompare the 64-character SHA-256 hash value with the one for your desired AWS SAM CLI version in the AWS SAM CLI release notes on GitHub. - Unzip the installation files into a directory of your choice. The following is an example, using the
sam-installation
subdirectory.NoteIf your operating system doesn’t have the built-in unzip command, use an equivalent.$ unzip aws-sam-cli-linux-x86_64.zip -d sam-installation
- Install the AWS SAM CLI by running the
install
executable. This executable is located in the directory used in the previous step. The following is an example, using thesam-installation
subdirectory:$ sudo ./sam-installation/install
- Verify the installation.
$ sam --version
On successful installation, you should see output like the following: SAM CLI, version 1.58.0
Initialize a new project
Build your application for deployment
Perform local debugging and testing
Deploy your application
Reference
- Installing Jupyter: Get up and running on your computer - November 2, 2024
- An Introduction of SymOps by SymOps.com - October 30, 2024
- Introduction to System Operations (SymOps) - October 30, 2024