AWS SAM reference - AWS Serverless Application Model

AWS SAM reference

This section contains AWS SAM reference material. This includes AWS SAM CLI reference material, like reference information on AWS SAM CLI commands and additional AWS SAM CLI information, like configuration, version control, and troubleshooting information. Additionally, this section includes reference information on the AWS SAM specification and the AWS SAM template, like reference information on connectors, image repositories, and deployments.

AWS SAM specification and the AWS SAM template

The AWS SAM specification is an open-source specification under the Apache 2.0 license. The current version of the AWS SAM specification is available in the The AWS SAM project and AWS SAM template. AWS SAM specification comes with a simplified short-hand syntax you use to to define the functions, events, APIs, configurations, and permissions of your serverless application.

You interact with AWS SAM specification through the AWS SAM application project directory, which are the folders and files that are created when you run the sam init command. This directory includes the AWS SAM template, an important file that defines your AWS resources. the AWS SAM template is an extension of AWS CloudFormation template. For the full reference for AWS CloudFormation templates, see Template reference in the AWS CloudFormation User Guide.

AWS SAM CLI command reference

The AWS Serverless Application Model Command Line Interface (AWS SAM CLI) is a command line tool that you can use with AWS SAM templates and supported third-party integrations to build and run your serverless applications.

You can use the AWS SAM CLI commands to develop, test, and deploy your serverless applications to the AWS Cloud. The following are some examples of AWS SAM CLI commands:

  • sam init – If you're a first-time AWS SAM CLI user, you can run the sam init command without any parameters to create a Hello World application. The command generates a preconfigured AWS SAM template and example application code in the language that you choose.

  • sam local invoke and sam local start-api – Use these commands to test your application code locally, before deploying it to the AWS Cloud.

  • sam logs – Use this command to fetch logs that your Lambda function generates. This can help you with testing and debugging your application after you've deployed it to the AWS Cloud.

  • sam package – Use this command to bundle your application code and dependencies into a deployment package. You need the deployment package to upload your application to the AWS Cloud.

  • sam deploy – Use this command to deploy your serverless application to the AWS Cloud. It creates the AWS resources and sets permissions and other configurations that are defined in the AWS SAM template.

For instructions about installing the AWS SAM CLI, see Install the AWS SAM CLI.

AWS SAM policy templates

With AWS SAM, you can choose from a list of policy templates to scope your AWS Lambda function's permissions to the resources that your application uses. For a list of available policy templates, refer to Policy template table. For general information on policy templates and AWS SAM, refer to AWS SAM policy templates.

Topics