AWS Developer Tools Blog

Announcing AWS Toolkit for Visual Studio Code

Visual Studio Code has become an enormously popular tool for serverless developers, partly due to the intuitive user interface. It’s also because of the rich ecosystem of extensions that can customize and automate so much of the development experience. We are excited to announce that the AWS Toolkit for Visual Studio Code extension is now generally available, making it even easier for the development community to build serverless projects using this editor.

The AWS Toolkit for Visual Studio Code entered developer preview in November of 2018 and is open-sourced on GitHub, allowing builders to make their contributions to the code base and feature set. The toolkit enables you to easily develop serverless applications, including creating a new project, local debugging, and deploying your project—all conveniently from within the editor. The toolkit supports Node.js, Python, and .NET.

Using the AWS Toolkit for Visual Studio Code, you can:

  • Test your code locally with step-through debugging in a Lambda-like environment.
  • Deploy your applications to the AWS Region of your choice.
  • Invoke your Lambda functions locally or remotely.
  • Specify function configurations such as an event payload and environment variables.

We’re distributing the AWS Toolkit for Visual Studio Code under the open source Apache License, version 2.0.


From Visual Studio Code, choose the Extensions icon on the Activity Bar. In the Search Extensions in Marketplace box, enter AWS Toolkit and then choose AWS Toolkit for Visual Studio Code as shown below. This opens a new tab in the editor showing the toolkit’s installation page. Choose the Install button in the header to add the extension.

After you install the AWS Toolkit for Visual Studio Code, you must complete these additional steps to access most of its features:

To use this toolkit to develop serverless applications with AWS, you must also do the following on the local machine where you install the toolkit:

For complete setup instructions, see Setting Up the AWS Toolkit for Visual Studio Code in the AWS Toolkit for Visual Studio Code User Guide.

Building a serverless application with the AWS Toolkit for Visual Studio Code

In this example, you set up a Hello World application using Node.js:

1. Open the Command Palette by choosing Command Palette from the View menu. Type AWS to see all the commands available from the toolkit. Choose AWS: Create new AWS SAM Application.

2. Choose the nodejs10.x runtime, specify a folder, and name the application Hello World. Press Enter to confirm these settings. The toolkit uses AWS SAM to create the application files, which appear in the Explorer panel.

3. To run the application locally, open the app.js file in the editor. CodeLenses appears above the handler function, showing options to Run Locally, Debug Locally, or Configure the function. Choose Run Locally.

This uses Docker to run the function on your local machine. You can see the Hello World output in the console window.

Step-through debugging of the application

One of the most exciting features in the toolkit is also one of the most powerful in helping you find problems in your code: step-through debugging.

The AWS Toolkit for Visual Studio Code brings the power of step-through debugging to serverless development. It lets you set breakpoints in your code and evaluate variable values and object states. You can activate this by choosing Debug Locally in the CodeLens that appears above your functions.

This enables the Debug view, displaying information related to debugging the current application. It also shows a command bar with debugging options and launch configuration settings. As your function executes and stops at a breakpoint, the editor shows current object state when you hover over the code and allows data inspection in the Variables panel.

For developers familiar with the power of the debugging support within Visual Studio Code, the toolkit now lets you use those features with serverless development of your Lambda functions. This makes it easier to diagnose problems quickly and iteratively, without needing to build and deploy functions remotely or rely exclusively on verbose logging to isolate issues.

Deploying the application to AWS

The deployment process requires an Amazon S3 bucket with a globally unique name in the same Region where your application runs

1. To create an S3 bucket from the terminal window, enter:

aws s3 mb s3://your-unique-bucket-name --region your-region

This requires the AWS CLI, which you can install by following the instructions detailed in the documentation. Alternatively, you can create a new S3 bucket in the AWS Management Console.

2. Open the Command Palette by choosing Command Palette from the View menu. Type AWS to see all the commands available from the toolkit. Choose AWS: Deploy a SAM Application.

3. Choose the suggested YAML template, select the correct Region, and enter the name of the bucket that you created in step 1. Provide a name for the stack, then press Enter. The process may take several minutes to complete. After it does, the Output panel shows that the deployment completed.

Invoking the remote function

With your application deployed to the AWS Cloud, you can invoke the remote function directly from the AWS Toolkit for Visual Studio Code:

  1. From the Activity Bar, choose the AWS icon to open AWS Explorer.
  2. Choose Click to add a region to view functions… and choose a Region from the list.
  3. Click to expand CloudFormation and Lambda. Explorer shows the CloudFormation stacks and the Lambda functions in this Region.
  4. Right-click the HelloWorld Lambda function in the Explorer panel and choose Invoke on AWS. This opens a new tab in the editor.
  5. Choose Hello World from the payload template dropdown and choose Invoke. The output panel displays the ‘hello world’ JSON response from the remote function.

Congratulations! You successfully deployed a serverless application to production using the AWS Toolkit for Visual Studio Code. The User Guide includes more information on the toolkit’s other development features.


In this post, I demonstrated how to deploy a simple serverless application using the AWS Toolkit for Visual Studio Code. Using this toolkit, developers can test and debug locally before deployment, and modify AWS resources defined in the AWS SAM template.

For example, by using this toolkit to modify your AWS SAM template, you can add an S3 bucket to store images or documents, add a DynamoDB table to store user data, or change the permissions used by your functions. It’s simple to create or update stacks, allowing you to quickly iterate until you complete your application.

AWS SAM empowers developers to build serverless applications more quickly by simplifying AWS CloudFormation and automating the deployment process. The AWS Toolkit for Visual Studio Code takes the next step, allowing you to manage the entire edit, build, and deploy process from your preferred development environment. We are excited to see what you can build with this tool!