Getting started with Terraform support for AWS SAM CLI - AWS Serverless Application Model

Getting started with Terraform support for AWS SAM CLI

Terraform support is in preview release for the AWS SAM CLI and is subject to change. To provide feedback and submit feature requests, create a GitHub Issue.

The AWS Serverless Application Model Command Line Interface (AWS SAM CLI) supports local debugging and testing of AWS Lambda functions and layers within your Terraform projects.

AWS SAM CLI Terraform prerequisites

Complete all prerequisites to begin using the AWS SAM CLI with your Terraform projects.

  1. Install Python 3.6 or newer

    Python 3.6 or newer is required for use with the AWS SAM CLI. For installation instructions, see Downloading Python in Python's Beginners Guide.

    Verify that Python 3.6 or newer is added to your machine path by running:

    python --version

    The output should display a version of Python that is 3.6 or newer.

  2. Install or upgrade the AWS SAM CLI

    To check if you have the AWS SAM CLI installed, run the following:

    sam --version

    If the AWS SAM CLI is already installed, the output will display a version. To upgrade to the newest version, see Upgrading the AWS SAM CLI.

    For instructions on installing the AWS SAM CLI along with all of its prerequisites, see Installing the AWS SAM CLI.

  3. Install Terraform

    To check if you have Terraform installed, run the following:

    terraform -version

    To install Terraform, see Install Terraform in Terraform's Developer Documentation.

  4. Install Docker for local testing

    The AWS SAM CLI requires Docker for local testing. To install Docker, see Installing Docker to use with the AWS SAM CLI.

  5. Install the make tool (Windows only)

    Make is a package manager and installer for Windows. To install using Chocolatey, see Using Chocolatey in How to Install and Use "Make" in Windows.

Next steps

You're now ready to begin using the AWS SAM CLI with your Terraform projects. To learn more, see: