AWS Developer Tools Blog

Faster iteration experience for AWS SAM applications in the AWS Toolkits for JetBrains and VS Code

Today, the AWS Toolkits for JetBrains and VS Code released a faster code iteration experience for developing AWS SAM applications. The AWS Toolkits are open source plugins for JetBrains and VS Code IDEs that provide an integrated experience for developing Serverless applications, including assistance for getting started and local step-through debugging capabilities for Serverless applications. With today’s release, the Toolkits adds SAM CLI’s Lambda “sync” capabilities shipped as SAM Accelerate (check out the announcement). These new features in the Toolkits for JetBrains and VS Code provide customers with increased flexibility. Customers can either sync their entire Serverless application (i.e., infrastructure and the code), or sync just the code changes and skip Cloudformation deployments. The code changes, in this context, refer to changes to the AWS Lambda functions, Lambda Layer resources, StepFunction templates or relevant APIGateway documents (see AWS SAM Accelerate Docs to learn more).

Note: In the latest versions of the Toolkits, the previous Deploy Serverless Application experience is replaced with the new Sync Serverless Application experience. We recommend using Sync capabilities in non-production environments, as these features are provided for syncing changes to your development environment while you iterate on your application. 

Synchronizing SAM Application from the AWS Toolkits

Prerequisites

For synchronizing your application depending on the corresponding AWS SAM template, you will need the following prerequisites:

Using the ‘Sync Serverless Application’ feature in JetBrains and VS Code

Open your Serverless application in the IDE (e.g. IntelliJ or VS Code). In the project window or the project workspace view in the IDE, right click on the project’s template.yaml file, and select option “Sync Serverless Application”. By clicking Sync Serverless Application, the toolkit will synchronize all changes including infrastructure and code. After selecting the option to “Sync Serverless Application”, you will be prompted with options to fill out the Sync settings, such as setting the new stack name or updating an existing stack,  the S3 bucket to store your template.yaml files, tags, and so on. See below screens showing the experience in JetBrains and VS Code IDEs. You will see the ongoing Sync process in the terminal output.

Sync Serverless Application in JetBrains IDEs

Sync Serverless Application in VS Code

Using the ‘Sync Serverless Application (code only)’ feature

You can also skip deploying the infrastructure changes when your updates are limited to only the code. To enable this capability for deploying just the code changes, customers can select it from the experimental menu provided in the Toolkits for JetBrains or VSCode. Once enabled, the right+click menu from template.yaml will contain a new menu item, Sync Serverless Application (code only). You can select this ‘code only’ option, to synchronize only the code changes and skip infrastructure deployments, which allows them to rapidly test code changes in the cloud. For a quick look at how to enable experimental features, check out the AWS Toolkit user guide for JetBrains and VS Code. Below are screens showing how to enable/disable Sync features in the Toolkit from the Experimental Features menu.

.    

When both Sync options are enabled, click on Sync Serverless Application (code only) and you’ll be able to update your code within a few seconds.

Reverting to ‘Deploy Serverless Application’

To revert to the previous Deploy Serverless Application experience you need to disable the Sync Serverless Application option from the experimental menu in JetBrains IDEs or using the settings (aws.samcli.legacyDeploy) in VS Code.

Future Improvements

In this post, we provide a brief overview of the new faster code iteration experience delivered in the AWS Toolkits for JetBrains and VS Code IDEs that leverage SAM Sync and Sam Sync Code capabilities. Our roadmap includes plans for making Serverless application development faster and more intuitive in the IDEs by leveraging newer features (e.g. sam watch). We invite you to contribute feedback by submitting issues on GitHub (JetBrains, VS Code), or by using the “Send Feedback” action in the AWS Toolkit.