Syncing AWS SAM applications from the AWS Toolkit for JetBrains
AWS Serverless Application Model (AWS SAM) sam sync
is an AWS SAM-CLI-command deployment process that automatically identifies changes made to your serverless applications, then chooses the best way to build and deploy those changes to the AWS Cloud. If you've only made changes to your application code without changing the infrastructure, AWS SAM Sync updates your application without redeploying your AWS CloudFormation stack.
For additional information about sam sync
and AWS SAM CLI commands, see the AWS SAM CLI command reference topic in the AWS Serverless Application Model User Guide.
The following sections describe how to get started working with AWS SAM Sync.
Prerequisites
Prior to working with AWS SAM Sync, the following prerequisites must be met:
You have a working AWS SAM application. For more information on creating a AWS SAM application, see the Working with AWS SAM topic in this User Guide.
You've installed version 1.78.0. (or later) of the AWS SAM CLI. For more information on installing the AWS SAM CLI, see the Installing the AWS SAM CLI topic in the AWS Serverless Application Model User Guide.
Your application is running in a development environment.
Note
To sync and deploy a serverless application that contains an AWS Lambda function with any non-default properties, the optional properties must be set in the AWS SAM template file associated with the AWS Lambda function, prior to deployment.
To learn more about AWS Lambda properties, see the AWS::Serverless::Function
Getting Started
To get started working with AWS SAM Sync, complete the following procedure.
Note
Make sure that you're AWS Region is set to the location associated with your serverless application.
To learn more about changing your AWS region from the AWS Toolkit for JetBrains, see the Switch between AWS Regions topic in this User Guide.
From your serverless application project in the Project tool window, open the context menu for (right-click) your
template.yaml
file.From the
template.yaml
context menu, choose Sync Serverless Application (formerly Deploy) to open the Confirm development stack dialog.Confirm that you are working from a development stack to open the Sync Serverless Application dialog.
Complete the steps in the Sync Serverless Application dialog, then choose Sync to begin the AWS SAM Sync process. To learn more about the Sync Serverless Application dialog, see the Sync Serverless Application Dialog section located below.
During the sync process, the AWS Toolkit for JetBrains Run Window is updated with the deployment status.
Following a successful sync, the name of your AWS CloudFormation stack is added to the AWS Explorer.
If the sync fails, troubleshooting details can be found in the JetBrains Run Window or the AWS CloudFormation event logs. To learn more about viewing AWS CloudFormation event logs, see the Viewing event logs for a stack topic in this User Guide.
Sync Serverless Application Dialog
The Sync serverless application dialog assists you with the AWS SAM sync process. The following sections are descriptions and details for each of the different dialog components.
Create Stack or Update Stack
Required: To create a new deployment stack, enter a name in the provided field to create and set the AWS CloudFormation stack for your serverless application deployment.
Alternatively, to deploy to an existing AWS CloudFormation stack, select the stack name from the auto-populated list of stacks associated with your AWS account.
Template Parameters
Optional: Populates with a list of parameters detected from your project template.yaml
file. To specify parameter values, enter a new parameter value into the provided text-field located in the value column.
S3 Bucket
Required: To choose an existing Amazon Simple Storage Service (Amazon S3) bucket for storing your AWS CloudFormation template, select it from the list.
To create and use new Amazon S3 bucket for storage, choose Create and follow the prompts.
ECR Repository
Required, only visible when working with an Image package type: Choose an existing Amazon Elastic Container Registry (Amazon ECR) repository URI for deployment of your serverless application.
For information about AWS Lambda package types, see the Lambda deployment packages section in the AWS Lambda Developer Guide.
CloudFormation Capabilities
Required: Choose the capabilities that AWS CloudFormation is allowed to use when creating stacks.
Tags
Optional: Enter your preferred tags in the provided text fields to tag a parameter.
Build Function Inside a Container
Optional, Docker required: Selecting this options builds your serverless-application functions inside of a local Docker container, prior to deployment. This option is useful if a function depends on packages with natively compiled dependencies or programs.
For more information, see the Building applications topic in the AWS Serverless Application Model Developer Guide.