sam publish - Amazon Serverless Application Model
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

sam publish

This page provides reference information for the Amazon Serverless Application Model Command Line Interface (Amazon SAM CLI) sam publish command.

For an introduction to the Amazon SAM CLI, see What is the Amazon SAM CLI?.

The sam publish command publishes an Amazon SAM application to the Amazon Serverless Application Repository. This command takes a packaged Amazon SAM template and publishes the application to the specified Amazon Region.

The sam publish command expects the Amazon SAM template to include a Metadata section that contains application metadata required for publishing. In the Metadata section, the LicenseUrl and ReadmeUrl properties must refer to Amazon Simple Storage Service (Amazon S3) buckets, not local files. For more information about the Metadata section of the Amazon SAM template, see Publishing your application with the Amazon SAM CLI.

By default, sam publish creates the application as private. Before other Amazon accounts are allowed to view and deploy your application, you must share it. For information on sharing applications, see Amazon Serverless Application Repository Resource-Based Policy Examples in the Amazon Serverless Application Repository Developer Guide.

Note

Currently sam publish doesn't support publishing nested applications that are specified locally. If your application contains nested applications, you must publish them separately to the Amazon Serverless Application Repository before publishing your parent application.

Usage

$ sam publish <options>

Options

--config-env TEXT

The environment name specifying the default parameter values in the configuration file to use. The default value is "default". For more information about configuration files, see Amazon SAM CLI configuration file.

--config-file PATH

The path and file name of the configuration file containing default parameter values to use. The default value is "samconfig.toml" in the root of the project directory. For more information about configuration files, see Amazon SAM CLI configuration file.

--debug

Turns on debug logging to print debug messages that the Amazon SAM CLI generates, and to display timestamps.

--help

Shows this message and exits.

--profile TEXT

The specific profile from your credential file that gets Amazon credentials.

--region TEXT

The Amazon Region to deploy to. For example, us-east-1.

--save-params

Save the parameters that you provide at the command line to the Amazon SAM configuration file.

--semantic-version TEXT

(Optional) Use this option to provide a semantic version of your application that overrides the SemanticVersion property in the Metadata section of the template file. For more information about semantic versioning, see the Semantic Versioning specification.

--template, -t PATH

The path of Amazon SAM template file [default: template.[yaml|yml]].

Examples

To publish an application:

$ sam publish --template packaged.yaml --region us-east-1