AWS Serverless Application Model
Developer Guide

Installing the AWS SAM CLI on Linux

To install the AWS SAM CLI on Linux, first make sure that you've installed the AWS Command Line Interface (AWS CLI) and Docker for Linux.

Docker for Linux

You need to have Docker installed and running to be able to run serverless projects and functions locally with the AWS SAM CLI. The AWS SAM CLI uses the DOCKER_HOST environment variable to contact the Docker daemon.

To install Docker on Linux, see About Docker CE. In the left-hand column, choose Linux, choose your Linux distribution (for example, CentOS, Debian, or Ubuntu), and follow the installation instructions.

Verify that Docker is working, and that you can run Docker commands from the AWS SAM CLI (for example, docker ps). You don't need to install/fetch/pull any containers because the AWS SAM CLI does it automatically, as required.

Install the AWS SAM CLI Using Linuxbrew

Follow these steps to install the AWS SAM CLI by using Linuxbrew:

  1. To install the Linuxbrew package manager, follow the instructions on the Linuxbrew website.

  2. Upgrade Linuxbrew, and update it to the latest version.

    brew upgrade brew update
  3. Add a brew tap from GitHub.

    brew tap aws/tap
  4. Install aws-sam-cli from the brew tap.

    brew install aws-sam-cli

Now sam is installed to the following location:

/home/linuxbrew/.linuxbrew/bin/sam

You should be able to invoke sam from the command line.

sam --version

Install the AWS SAM CLI Using Pip

An alternate method of installing the AWS SAM CLI is by using pip. For details on how to do this, see Installing Using Pip.