SAM Deploy

The AWS SAM CLI includes a guided interactive mode, which walks you through the parameters required for deployment, provides default options, and saves these options in a configuration file in your project folder.

Once configured, you can redeploy your application by simply executing sam deploy and the required parameters will be retrieved from the AWS SAM CLI configuration file.

Building your app

Any time you make changes to the code in your AWS Lambda functions, you must ensure that you have built a new version before deploying to AWS. As you did previously, simply run the following command from the root of your SAM application, e.g., sam-app:

make build

SAM guided deployment

In a terminal window, in the root of your SAM application, copy and paste the following text:

sam deploy --guided

Follow the on-screen prompts to choose:

  • a name for your stack or accept the default (the name of your SAM app)
  • an AWS Region where SAM will deploy your app or accept the default
  • whether to confirm changes before deploying
  • whether to allow SAM CLI to create any required IAM roles
  • whether to save the arguments to samconfig.toml for future deployments
Terminal showing results of 'sam deploy --guided' command.

sam deploy --guided

Once the guided deployment completes your SAM app will be live in the AWS region you selected! SAM CLI also displays the Output parameters for your app, including HelloWorldAPI. You can test your function by sending an HTTP POST request to this endpoint, using a tool like httpie or Postman.

Terminal showing results of 'http post' command.

http post

For additional information see the sam deploy documentation.