What is AWS SAM?
The AWS Serverless Application Model (AWS SAM) is an open-source framework for describing, locally testing, and deploying serverless applications using infrastructure as code. It has two parts: the AWS SAM CLI as a command line tool, and the AWS SAM template, an extension of AWS CloudFormation with simplified syntax for serverless resources.
Running sam init creates a project directory that typically contains the SAM template, application code, and other configuration files. During deployment, the resources declared in shorthand syntax are transformed into CloudFormation resources.
Core Features
- Shorthand syntax: Define Lambda functions, Lambda durable functions, Amazon API Gateway APIs, Amazon DynamoDB tables, and other serverless resources with minimal code
- CloudFormation extension: SAM resources and standard CloudFormation resources in the same template
- Local testing and debugging: Run Lambda functions locally, simulate API Gateway endpoints, and find issues before deployment
- sam sync: Continuously sync local changes to the cloud and shorten test cycles
- AWS SAM connectors: Describe permissions between resources as intent; SAM generates the matching IAM permissions
- Pipelines: Per the product page,
sam pipelinecreates or modifies CI/CD pipelines - Terraform support: Local debugging and testing of Lambda functions and layers in Terraform projects
- Full lifecycle: Authoring, building, deploying, testing, and monitoring through the SAM CLI
Typical Use Cases
Serverless applications: Declare functions, APIs, and tables with minimal code and deploy them repeatably.
Extend existing templates: Add serverless components to traditional infrastructure in existing CloudFormation templates.
Local development: Test and debug functions and endpoints on your development machine before they run in AWS.
Migration from the console: Convert Lambda functions and API Gateway resources created in the AWS Management Console into SAM templates and manage them as code.
Benefits
- Considerably shorter templates for serverless resources than plain CloudFormation
- Familiar CloudFormation mechanics, including predictable deployments
- Faster development cycles through local testing and
sam sync - Permissions described through connectors instead of hand-maintained IAM policies
- Combinable with the AWS CDK and with Terraform projects
- Open source with no separate licensing cost
Integration with innFactory
As an AWS Reseller, innFactory supports you with AWS SAM: structuring SAM projects, converting console-created serverless resources into templates, building local test and debugging workflows, and setting up CI/CD pipelines for serverless applications.
Typical Use Cases
Technical Specifications
Frequently Asked Questions
What is AWS SAM?
Per the documentation, the AWS Serverless Application Model (AWS SAM) is an open-source framework for building serverless applications using infrastructure as code. It consists of the AWS SAM CLI for developing, locally testing, and deploying applications, and the AWS SAM template, an extension of AWS CloudFormation with simplified syntax for serverless resources.
How does SAM relate to AWS CloudFormation?
Per the documentation, SAM templates are an extension of CloudFormation. Resources declared in the shorthand syntax are transformed into infrastructure during deployment. SAM resources work alongside standard CloudFormation resources in the same template, so you can add serverless components to existing templates.
When should I use SAM instead of the CDK?
Per the documentation, use SAM if you prefer a declarative approach to describing your infrastructure and the AWS CDK if you prefer a programmatic one. The two can be combined: the SAM CLI's local testing features can also be used with CDK applications.
What can I test locally with the SAM CLI?
Per the documentation, you can test Lambda functions locally, simulate API Gateway endpoints, and debug serverless applications on your development machine before deploying to AWS. The sam sync command continuously syncs local changes to the cloud, which speeds up development and cloud testing workflows.
What are AWS SAM connectors?
With AWS SAM connectors you define the permissions you want between your AWS resources inside the template. Per the documentation, AWS SAM transforms that intent into the IAM permissions required.
Does SAM support Terraform projects?
Yes. Per the documentation, you can use the AWS SAM CLI to perform local debugging and testing of Lambda functions and layers in Terraform projects.
Note: All product information on this page has been compiled with care, but is provided without guarantee and may be outdated or incomplete. Cloud services evolve rapidly — features, pricing, SLAs, and availability change frequently. Authoritative and up-to-date information can only be found on the official product page of AWS (official documentation). This page does not represent an offer by AWS.