Options for deploying your application with AWS SAM (original) (raw)

With AWS SAM, you can deploy your application manually and you can also automate deployments. Use the AWS SAM CLI to manually deploy your application. To automate deployment, use pipelines and a continuous integration and continuous deployment (CI/CD) system. The topics in this section provide information on both approaches.

Topics

How to use the AWS SAM CLI to manually deploy

After you develop and test your serverless application locally, you can deploy your application using the sam deploy command.

To have AWS SAM guide you through the deployment with prompts, specify the--guided flag. When you specify this flag, the sam deploy command zips your application artifacts, uploads them either to Amazon Simple Storage Service (Amazon S3) (for .zip file archives) or to Amazon Elastic Container Registry (Amazon ECR) (for container images). The command then deploys your application to the AWS Cloud.

Example:

# Deploy an application using prompts:
sam deploy --guided

Deploy with CI/CD systems and pipelines

AWS SAM helps you automate deployment using pipelines and a continuous integration and continuous deployment (CI/CD) system. AWS SAM can be used to create pipelines and simplify CI/CD tasks for serverless applications. Multiple CI/CD systems support AWS SAM build container images, and AWS SAM also provides a set of default pipeline templates for multiple CI/CD systems that encapsulate AWS's deployment best practices.

For more information, see Using CI/CD systems and pipelines to deploy with AWS SAM.

Gradual deployments

If you want to deploy your AWS SAM application gradually rather than all at once, you can specify deployment configurations that AWS CodeDeploy provides. For more information, see Working with deployment configurations in CodeDeploy in the_AWS CodeDeploy User Guide_.

For information about configuring your AWS SAM application to deploy gradually, see Deploying serverless applications gradually with AWS SAM.

Troubleshooting deployments using the AWS SAM CLI

AWS SAM CLI error: "Security Constraints Not Satisfied"

When running sam deploy --guided, you're prompted with the questionHelloWorldFunction may not have authorization defined, Is this okay? [y/N]. If you respond to this prompt with N (the default response), you see the following error:

Error: Security Constraints Not Satisfied

The prompt is informing you that the application you're about to deploy might have an Amazon API Gateway API configured without authorization. By responding N to this prompt, you're saying that this is not OK.

To fix this, you have the following options:

Learn more

For hands-on examples of deploying serverless applications, see the following from The Complete AWS SAM Workshop: