AWS SAM

Use the AWS SAM (Serverless Application Model) with LocalStack

AWS SAM

Overview

The AWS Serverless Application Model (SAM) is a framework on top of CloudFormation to quickly develop Cloud Applications with a focus on serverless services such as S3, Lambda, API Gateway, Step Functions and more.

AWS SAM CLI for LocalStack

To deploy SAM applications on LocalStack you can use samlocal, a wrapper for the AWS SAM CLI.

Installation

Simply use pip to install samlocal as a Python library on your machine:

  1. $ pip install aws-sam-cli-local

Usage

The samlocal command has the exact same usage as the underlying sam command. The main difference is that for commands like samlocal deploy the operations will be executed against the LocalStack endpoints (http://localhost:4566 by default) instead of real AWS endpoints.

  1. $ samlocal --help

Start using samlocal by deploying a Hello World Application. Please make sure to replace all sam calls with samlocal when following the AWS tutorial.

Configuration

  • EDGE_PORT: Port number under which the LocalStack edge service is available (default: 4566)
  • LOCALSTACK_HOSTNAME: Host under which the LocalStack edge service is available (default: localhost)

Last modified October 11, 2021: minor: rename folder Integrations->integrations (68c86019)