The AWS Serverless Application Model (AWS SAM) is an open-source framework that you can use to build serverless applications on AWS.

serverless application is a combination of Lambda functions, event sources, and other resources that work together to perform tasks. Note that a serverless application is more than just a Lambda function — it can include additional resources such as APIs, databases, and event source mappings.

TLDR;

So let’s install the AWS SAM CLI first. In this article, I am going to use Linux.

In order to install SAM, you have to install homebrew first. Homebrew is a free and open-source software package management system

$ sh -c “$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"

Add homebrew to your path after installation. Just copy and paste the command on your terminal.

test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.bash_profile && echo “eval \$($(brew — prefix)/bin/brew shellenv)” >>~/.bash_profile
echo “eval \$($(brew — prefix)/bin/brew shellenv)” >>~/.profile

After successful installation of homebrew, now let’s install SAM:

$ brew tap aws/tap
$ brew install aws-sam-cli

Let’s verify the installation:

$ sam --version

You should see something like this.

Image for post

SAM is successfully installed. So let’s create a Hello World REST API with SAM in node.js.

Download a Sample AWS SAM Application

$ sam init

#aws #aws-sam #serverless #aws-lambda #nodejs

Getting Started With AWS SAM
1.75 GEEK