cloudparts

AWS Serverless Application Model (SAM)

A shorthand for serverless apps on top of CloudFormation, plus a CLI that builds them, runs functions and APIs locally in Docker, and deploys them.

Type
Managed service on AWS
Made by
Amazon Web Services
License
Apache 2.0
Facts checked
23 October 2026

What it is

SAM has two parts. The template is a CloudFormation template with one extra line, Transform: AWS::Serverless-2016-10-31, which unlocks resource types such as AWS::Serverless::Function, Api, HttpApi, SimpleTable, StateMachine and LayerVersion. When CloudFormation processes the template, the transform expands each of them into ordinary resources: a function becomes a Lambda function plus its execution role, and an Events entry becomes the API Gateway route, queue mapping or schedule that triggers it. Permissions come from policy templates such as SQSPollerPolicy or from connectors, which turn “this function writes to that table” into the needed IAM policy. Plain CloudFormation resources can sit in the same file.

The SAM CLI covers the rest of the loop. sam init starts a project from a template, sam build installs dependencies and packages each function, and sam deploy --guided uploads the artifacts to S3 and deploys the stack through CloudFormation, saving your answers in samconfig.toml. sam local invoke and sam local start-api run functions and an emulated API on your machine in Docker containers that mimic the Lambda runtime. sam sync --watch targets a development stack: code-only changes go straight to the service APIs in seconds instead of through a CloudFormation deployment. The CLI can also build and locally test Lambda functions defined in Terraform. Both the transform and the CLI are open source under Apache 2.0 and released often; the CLI was at 1.170 in October 2026.

Why teams pick it

  • A function with its API route, trigger and permissions fits in a dozen lines of YAML, and the result is still a normal CloudFormation stack
  • Local testing in Docker containers that mimic Lambda, with emulated API Gateway endpoints, before anything is deployed
  • sam sync --watch updates code in a development stack in seconds, bypassing CloudFormation for code-only changes
  • Mixes freely with plain CloudFormation resources, and the CLI’s local testing also works with CDK and Terraform projects

Watch out for

  • AWS only, and every deployment is a CloudFormation stack, with its quotas, speed and rollback behaviour
  • Declarative YAML with no loops or functions of its own; larger apps either grow long templates or move to the CDK
  • The local emulation is not the real service: local runs need Docker, and IAM permissions and other managed services still have to be tested in the cloud
  • Only some resources have SAM shorthand; everything else is written as verbose CloudFormation in the same template

How it fits with other technologies

template.yaml: a function behind an HTTP API, with a table and a scoped policy · yaml

AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Resources:
  Orders:
    Type: AWS::Serverless::SimpleTable
  OrdersFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: src/
      Handler: app.handler
      Runtime: python3.13
      Environment:
        Variables:
          TABLE: !Ref Orders
      Policies:
        - DynamoDBCrudPolicy:
            TableName: !Ref Orders
      Events:
        GetOrder:
          Type: HttpApi
          Properties:
            Path: /orders/{id}
            Method: get

# sam build && sam local start-api   -> http://127.0.0.1:3000
# sam deploy --guided

See it in a real stack

No architecture uses AWS Serverless Application Model (SAM) yet. Drop it into the playground and wire it up yourself.Open playground →
Where it came from2016–2026

A serverless app on AWS Lambda is many small pieces: functions, their roles, API Gateway resources and methods, permissions, tables. Written as raw CloudFormation, each one needs its own block of JSON. On November 18, 2016 AWS introduced the Serverless Application Model, previously known as Project Flourish, as a specification CloudFormation supports natively: a transform that expands a few lines for a function, an API or a table into the full set of resources. It came with two new AWS CLI commands, aws cloudformation package and aws cloudformation deploy, and was released under Apache 2.0 so other tools could build on it.

Testing locally came next. The SAM CLI ran functions in Docker containers, at first using the docker-lambda images built by the community developer Michael Hart. AWS describes SAM as open source and generally available since April 2018; the CLI reached 1.0 on July 21, 2020, switching to AWS-provided emulation images and adding builds for custom runtimes and layers.

Later work aimed at the slow edit, deploy and test loop: SAM Accelerate and sam sync appeared in beta in October 2021, connectors simplified permissions, the CLI gained support for testing functions defined in Terraform, and in 2026 sam deploy --express passes CloudFormation’s new express mode through.

Why it’s built this way

A CloudFormation transform instead of a separate deployment engine
Expanding shorthand inside CloudFormation meant SAM apps got stacks, change sets and rollback for free, and could mix in any other AWS resource.
Events declared on the function
Most serverless resources exist to trigger a function. Listing triggers under the function lets SAM create the route, mapping or rule and the permission to invoke it in one place.
Local emulation in Docker
Containers that mimic the Lambda runtime let developers run and debug functions on a laptop without deploying, without writing their own mocks of the runtime.
An open specification under Apache 2.0
AWS published the model so third-party tools could generate or consume SAM templates, not just its own CLI.

Timeline

  1. 2016

    SAM introduced on November 18 as a CloudFormation transform

  2. 2018

    Open source and generally available, per AWS, from April

  3. 2020

    SAM CLI 1.0 generally available on July 21

  4. 2021

    SAM Accelerate and sam sync in beta in October

  5. 2026

    sam deploy --express uses CloudFormation express mode

Sources11 · facts checked 23 October 2026

Improve this page on GitHub