Installing the AWS SAM CLI - AWS Serverless Application Model

Installing the AWS SAM CLI

Install the latest release of the AWS Serverless Application Model Command Line Interface (AWS SAM CLI) on supported operating systems.

To learn how to manage a currently installed version of the AWS SAM CLI, including how to upgrade, uninstall, or manage nightly builds, see Managing AWS SAM CLI versions.

Important

Before you continue, complete all prerequisites in the previous section.

Installing the AWS SAM CLI

To install the AWS SAM CLI, follow the instructions for your operating system.

x86_64 - command line installer
  1. Download the AWS SAM CLI .zip file to a directory of your choice.

  2. 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.zip

    Compare 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.

  3. Unzip the installation files into the sam-installation/ subdirectory.

    Note

    If 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
  4. Install the AWS SAM CLI.

    sudo ./sam-installation/install
  5. Verify the installation.

    sam --version

    On successful installation, you should see output like the following:

     SAM CLI, version 1.58.0
ARM - command line installer
  1. Use pip to install the AWS SAM CLI.

    pip install aws-sam-cli
  2. Verify the installation.

    sam --version

    On successful installation, you should see output like the following:

     SAM CLI, version 1.58.0
Homebrew
Important

You must have Homebrew installed on your Linux machine. For install instructions, see Installing Homebrew to use with the AWS SAM CLI.

To install the AWS SAM CLI using Homebrew, run the following commands:

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

Verify the installation.

sam --version

On successful installation of the AWS SAM CLI, you should see output like the following:

SAM CLI, version 1.58.0

The recommended approach for installing the AWS SAM CLI on macOS is to use the Homebrew package manager. For more information about Homebrew, see Homebrew Documentation on the Homebrew website.

Homebrew
Important

You must have Homebrew installed on your Linux machine. For install instructions, see Installing Homebrew to use with the AWS SAM CLI.

Follow these steps to install the AWS SAM CLI using Homebrew:

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

Verify the installation:

sam --version

After successful installation of the AWS SAM CLI, you should see output like the following:

SAM CLI, version 1.58.0

Windows Installer (MSI) files are the package installer files for the Windows operating system.

Follow these steps to install the AWS SAM CLI using the MSI file.

  1. Install the AWS SAM CLI 64-bit.

    Note

    If you use a 32-bit version of Windows, see Installing AWS SAM CLI on 32-bit Windows.

  2. Verify the installation.

    After completing the installation, verify it by opening a new command prompt or PowerShell prompt. You should be able to invoke sam from the command line.

    sam --version

    After successful installation of the AWS SAM CLI, you should see output like the following:

    SAM CLI, version 1.58.0
  3. Enable long paths (Windows 10 and newer only).

    Important

    The AWS SAM CLI app templates repository contains some long file paths which may cause errors when running sam init due to Windows 10 MAX_PATH limitations. To resolve this issue, the new long paths behavior must be configured.

    To enable long paths, see Enable Long Paths in Windows 10, Version 1607, and Later in the Microsoft Windows App Development Documentation.

  4. Install Git.

    To download sample applications using the sam init command, you must also install Git. For instructions, see Installing Git.

Troubleshooting

If you come across issues while installing the AWS SAM CLI, see Troubleshooting installation errors.

Next steps

To learn more about the AWS SAM CLI and to begin building your own serverless applications, see the following: