Amazon SAM reference
This section contains Amazon SAM reference material. This includes Amazon SAM CLI reference material, like reference information on Amazon SAM CLI commands and additional Amazon SAM CLI information, like configuration, version control, and troubleshooting information. Additionally, this section includes reference information on the Amazon SAM specification and the Amazon SAM template, like reference information on connectors, image repositories, and deployments.
Amazon SAM specification and the Amazon SAM template
The Amazon SAM specification is an open-source specification under the Apache 2.0 license. The current version of the Amazon SAM specification is available in the The Amazon SAM project and Amazon SAM template. Amazon 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 Amazon SAM specification through the Amazon SAM application project directory, which are the folders and files that are created when you run the sam init command. This directory includes the Amazon SAM template, an important file that defines your Amazon resources. the Amazon SAM template is an extension of Amazon CloudFormation template. For the full reference for Amazon CloudFormation templates, see Template reference in the Amazon CloudFormation User Guide.
Amazon SAM CLI command reference
The Amazon Serverless Application Model Command Line Interface (Amazon SAM CLI) is a command line tool that you can use with Amazon SAM templates and supported third-party integrations to build and run your serverless applications.
You can use the Amazon SAM CLI commands to develop, test, and deploy your serverless applications to the Amazon Web Services Cloud. The following are some examples of Amazon SAM CLI commands:
-
sam init
– If you're a first-time Amazon SAM CLI user, you can run thesam init
command without any parameters to create a Hello World application. The command generates a preconfigured Amazon SAM template and example application code in the language that you choose. -
sam local invoke
andsam local start-api
– Use these commands to test your application code locally, before deploying it to the Amazon Web Services 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 Amazon Web Services 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 Amazon Web Services Cloud. -
sam deploy
– Use this command to deploy your serverless application to the Amazon Web Services Cloud. It creates the Amazon resources and sets permissions and other configurations that are defined in the Amazon SAM template.
For instructions about installing the Amazon SAM CLI, see Install the Amazon SAM CLI.
Amazon SAM policy templates
With Amazon SAM, you can choose from a list of policy templates to scope your Amazon 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 Amazon SAM, refer to Amazon SAM policy templates.