AWS Serverless Application Model
Developer Guide

Installing the AWS SAM CLI on Windows

The AWS Command Line Interface (AWS CLI) and Docker are required to install the AWS SAM CLI on Windows. The following steps describe how to successfully install the correct version of Docker, and how to install the AWS SAM CLI using either an MSI file or Pip.

Install Docker for Windows

Docker is an application that runs containers on your Windows or macOS machines. AWS SAM provides a local environment similar to AWS Lambda to use as a Docker container. You can use this container to build, test, and debug your Lambda functions.

You must have Docker installed and working 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. The following steps describe how to install, configure, and verify a Docker installation to work with the AWS SAM CLI.

1. Install Docker.

Docker Desktop supports the most recent Windows operating system. For legacy versions of Windows, the Docker Toolbox is available. Choose your version of Windows for the correct Docker installation steps:

2. Configure your shared drives.

The AWS SAM CLI requires that the project directory, or any parent directory, is listed in a shared drive. Choose your version of Windows below for the correct shared drive instructions:

3. Verify the installation.

After Docker is installed, verify that it's working. Aso confirm that you can run Docker commands from the AWS SAM CLI (for example, docker ps). You don't need to install, fetch, or pull any containers––the AWS SAM CLI does this automatically as required.

Install the AWS SAM CLI Using the MSI File

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

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

1. Install the AWS SAM CLI.

Choose your version of Windows for the correct MSI file:

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

Install the AWS SAM CLI Using Pip

Pip is a package installer for Python. Python is required for this installation.

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

  1. Verify that the Python version is 2.7 or 3.6.

    $ python --version

    If it isn't installed, download and install Python.

  2. Verify that pip is installed.

    $ pip --version

    If it isn't installed, download and install pip.

  3. Install aws-sam-cli.

    pip install --user aws-sam-cli
  4. Adjust your PATH to include the Python scripts that are installed under the user's home directory.

  5. Verify that sam is installed.

    Restart or open a new terminal, and verify that the installation worked.

    # Restart current shell $ sam --version

Troubleshooting

Python Not Installed

If you receive an error similar to the following, you might not have Python installed.

'""' is not recognized as an internal or external command, operable program or batch file.

Make sure that you have installed Python, and try again. To install Python for Windows, see Python Releases for Windows.