

# Getting Started with the AWS Toolkit for Visual Studio Code
<a name="setting-up"></a>

The AWS Toolkit for Visual Studio Code makes your AWS services and resources available, directly from your VS Code integrated development environment (IDE).

To get you started, the following topics describe how to set up, install, and configure the AWS Toolkit for Visual Studio Code.

**Topics**
+ [Installing the AWS Toolkit for Visual Studio Code](setup-toolkit.md)
+ [Connecting to AWS](connect.md)
+ [Changing AWS Regions](setup-region.md)
+ [Configuring your toolchain](setup-toolchain.md)

# Installing the AWS Toolkit for Visual Studio Code
<a name="setup-toolkit"></a>

## Prerequisites
<a name="setup-prereq"></a>

To get started working with AWS Toolkit for Visual Studio Code from VS Code, the following perquisites must be met. To learn more about accessing all of the AWS services and resources available from the AWS Toolkit for Visual Studio Code, see the [Optional prerequisites](#setup-prereq-opt) section of this guide.
+ VS Code requires a Windows, macOS, or Linux operating system.
+ The AWS Toolkit for Visual Studio Code requires you to work from VS Code version 1.73.0 or a later version.

For additional information about VS Code or to download the latest version of VS Code, see the [VS Code downloads](https://code.visualstudio.com/downloads) website. 

## Downloading and installing the AWS Toolkit for Visual Studio Code
<a name="setup-install"></a>

You can download, install, and set up the AWS Toolkit for Visual Studio Code through the VS Code Marketplace in your IDE. Alternatively, you can download the AWS Toolkit for Visual Studio Code installation files by navigating to the [ VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.aws-toolkit-vscode) from your web browser.

**Installing the AWS Toolkit for Visual Studio Code from the VS Code IDE Marketplace**

1. Open the AWS Toolkit for Visual Studio Code extension in your VS Code IDE with the following link: [Open the VS Code Marketplace](vscode:extension/amazonwebservices.aws-toolkit-vscode).
**Note**  
If VS Code is not already running on your machine, this operation may take a few moments while VS Code is loading.

1. From the AWS Toolkit for Visual Studio Code extension in the VS Code Marketplace, choose **Install** to begin the installation process.

1. When prompted, choose to restart VS Code to complete the installation process.

## Optional prerequisites
<a name="setup-prereq-opt"></a>

Before you can use certain features of the AWS Toolkit for Visual Studio Code, you must have the following:
+ **Amazon Web Services (AWS) account**: An AWS account isn't a requirement to use the AWS Toolkit for Visual Studio Code, but functionality is significantly limited without it. To obtain an AWS account, go to the [AWS home page](https://aws.amazon.com/). Choose **Create an AWS Account**, or **Complete Sign Up** (if you've visited the site before).
+ **Code Development** – The relevant SDK for the language that you want to use. You can download from the following links, or use your favorite package manager:
  + .NET SDK: [https://dotnet.microsoft.com/download](https://dotnet.microsoft.com/download)
  + Node.js SDK: [https://nodejs.org/en/download](https://nodejs.org/en/download)
  + Python SDK: [https://www.python.org/downloads](https://www.python.org/downloads)
  + Java SDK: [https://aws.amazon.com/corretto/](https://aws.amazon.com/corretto/)
  + Go SDK: [https://golang.org/doc/install](https://golang.org/doc/install)
+ **AWS SAM CLI** – This is an AWS CLI tool that helps you develop, test, and analyze your serverless applications locally. This isn't required for installing the toolkit. However, we recommend that you install it (and Docker, described next) because it's required for any AWS Serverless Application Model (AWS SAM) functionality, such as [Creating a new serverless application (local)](sam-get-started.md#serverless-apps-create).

  For more information, see [Installing the AWS SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) in the *[AWS Serverless Application Model Developer Guide](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html)*.
+ **Docker** – The AWS SAM CLI requires this open-source software container platform. For more information and download instructions, see [Docker](https://www.docker.com/). 
+ **Package Manager** – A package manager so you can download and share application code.
  + .NET: [NuGet](https://www.nuget.org/downloads)
  + Node.js: [npm](https://www.npmjs.com/package/npm)
  + Python: [pip](https://pypi.org/project/pip/)
  + Java: [Gradle](https://gradle.org/install/) or [Maven](https://maven.apache.org/download.cgi)

# Connecting to AWS
<a name="connect"></a>

Most Amazon Web Services (AWS) resources are managed through an AWS account. An AWS account isn't required to use the AWS Toolkit for Visual Studio Code, however Toolkit functions are limited without a connection.

If you've previously set up an AWS account and authentication through another AWS service (such as the AWS Command Line Interface), then the AWS Toolkit for Visual Studio Code automatically detects your credentials.

## Prerequisites
<a name="connecting-to-aws"></a>

If you're new to AWS or haven't created an account, then there are 3 main steps to connect the AWS Toolkit for Visual Studio Code with your AWS account:

1. **Signing up for an AWS account**: You can sign up for an AWS account from the [AWS sign up portal]( https://portal.aws.amazon.com/billing/signup). For detailed information on setting up a new AWS account, see the [ Overview ](https://docs.aws.amazon.com//SetUp/latest/UserGuide/setup-overview.html)topic in the *AWS Setup User Guide*.

1. **Setting up authentication**: There are 3 primary methods to authenticate with your AWS account from the AWS Toolkit for Visual Studio Code. To learn more about each of these methods, see the [Authentication and Access](https://docs.aws.amazon.com//toolkit-for-vscode/latest/userguide/establish-credentials.html) topic in this User Guide.

1. **Authenticating with AWS from the Toolkit**: You can connect with your AWS account from the Toolkit by completing the procedures in the following sections of this User Guide.

## Opening the Sign In panel
<a name="sign-in-pannel"></a>

Complete one of the following procedures to open the **AWS Toolkit Sign In** panel.

**To open the **AWS Toolkit Sign In** panel from the AWS Explorer:**

1. From the AWS Toolkit for Visual Studio Code, expand **EXPLORER**.

1. Expand the **More Actions...** menu by selecting the **...** icon. 

1. From the **More Actions...** menu, choose **Connect to AWS** to open the **AWS Toolkit Sign In** panel.

**To open the **AWS Toolkit Sign In** panel using the VS Code command pallet:**

1. Open the command pallet by pressing **Shift\$1Command\$1P** (**Ctrl\$1Shift\$1P** Windows).

1. Enter **AWS: Add a New Connection** into the search field.

1. Select **AWS: Add a New Connection** to open the **AWS Toolkit Sign In** panel.

## Connecting to AWS from the Toolkit
<a name="connect-to-aws"></a>

### Authenticate and connect with SSO
<a name="w2aac11c11c13b3"></a>

To authenticate and connect with AWS using AWS IAM Identity Center, complete the following procedure.

**Note**  
Authentication with AWS Builder ID or IAM Identity Center launches the AWS authorization portal in your default web browser. Each time your credentials expire this process must be repeated to renew the connection between your AWS account and the AWS Toolkit for Visual Studio Code.

**Authenticate and connect with AWS IAM Identity Center**

1. From the **AWS Toolkit Sign In** panel, choose the **Workforce** tab, then select the **Continue** button to proceed.

1. From the **Sign in with IAM Identity Center** panel, enter the **Start URL** for your organization. This URL is provided to you by an admin or help desk at your company.

1. Select your AWS **Region** from the drop-down menu. This is the AWS region that hosts your identity directory.

1. Choose the **Continue** button and confirm that you want to open the **AWS Authorization request** website in your default web browser.

1. Follow the prompts in your default web browser, you're notified when the authorization process is complete, it's safe to close your browser, and return to VS Code.

### Authenticate and connect with IAM Credentials
<a name="w2aac11c11c13b5"></a>

To authenticate and connect with AWS using IAM Credentials, complete the following procedure.

**Authenticate and connect with IAM Credentials**

1. From the **AWS Toolkit Sign In** panel, choose **IAM Credential**, then select the **Continue** button to proceed.

1. Enter the **Profile Name**, **Access Key**, and **Secret Key** of your AWS account in the provided fields, then choose the **Continue** button to add the profile to your config file and connect the Toolkit with your AWS account.

1. The Toolkit **AWS Explorer** updates to display your AWS services and resources when authentication is complete and a connection has been established.

## Authentication for Amazon CodeCatalyst
<a name="catalyst"></a>

To get started working with CodeCatalyst from the Toolkit, authenticate and connect with either your AWS Builder ID or IAM Identity Center credentials.

The following procedures describe how to authenticate and connect the Toolkit with your AWS account.

**Authenticate and connect with an AWS Builder ID**

1. From the **AWS Toolkit Sign In** panel, choose the **Workforce** tab, then select the **Continue** button to proceed.

1. At the top of the **Sign in with SSO** panel, choose the **Skip to sign-in** link.

1. Follow the prompts in your default web browser, you're notified when the authorization process is complete, it's safe to close your browser, and return to VS Code.

**Authenticate and connect with IAM Identity Center**

1. From the **AWS Toolkit Sign In** panel, choose the **Workforce** tab, then select the **Continue** button to proceed.

1. From the **Sign in with IAM Identity Center** panel, enter the **Start URL** for your organization. This URL is provided to you by an admin or help desk at your company.

1. Select your AWS **Region** from the drop-down menu. This is the AWS region that hosts your identity directory.

1. Choose the **Continue** button and confirm that you want to open the **AWS Authorization request** website in your default web browser.

1. Follow the prompts in your default web browser, you're notified when the authorization process is complete, it's safe to close your browser, and return to VS Code.

# Changing AWS Regions
<a name="setup-region"></a>

An AWS Region specifies where your AWS resources are managed. Your default AWS Region is detected when you connect to your AWS account from the AWS Toolkit for Visual Studio Code, automatically displaying in the **AWS Explorer**. 

The following sections describe how to add or hide a Region from the **AWS Explorer**.

## Adding a Region to the AWS Explorer
<a name="select-new-region"></a>

Complete the following procedure to add a Region to the AWS Explorer.

1. From VS Code, open the **Command Palette** by expanding **View** on the main menu and choosing **Command Palette**. Or use the following shortcut keys: 
   + Windows and Linux – Press **Ctrl\$1Shift\$1P**.
   + macOS – Press **Shift\$1Command\$1P**.

1. From the **Command Palette**, search for **AWS: Show or Hide Regions** and choose **AWS: Show or Hide Regions** to display a list of available Regions.

1. From the list, select the AWS Regions that you want to add to the **AWS Explorer**.

1. Choose the **OK** button to confirm your choices and update the **AWS Explorer**.

## Hide a Region from the AWS Explorer
<a name="hide-region"></a>

To hide a Region from the AWS Explorer view, complete the following procedure.

1. From the **AWS Explorer**, locate the AWS Region that you want to hide.

1. Open the context menu for (right-click) the Region you want to hide.

1. Choose **Show or Hide Regions** to open the **AWS: Show or Hide Regions** options in VS Code.

1. Deselect the Regions that you want to hide in the AWS Explorer view.

# Configuring your toolchain
<a name="setup-toolchain"></a>

The AWS Toolkit for Visual Studio Code supports multiple languages across all the AWS services. The following sections describe how to configure your toolchain for different languages.

## Configure a toolchain for .NET Core
<a name="setup-toolchain-for-net"></a>

1. Ensure that you have the AWS Toolkit for VS Code [installed](setup-toolkit.md#setup-install).

1. Install the [C\$1 extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp). This extension enables VS Code to debug .NET Core applications.

1. Open an AWS Serverless Application Model (AWS SAM) application, or [create one](sam-get-started.md#serverless-apps-create).

1. Open the folder that contains `template.yaml`.

## Configure a toolchain for Node.js
<a name="setup-toolchain-for-node"></a>

1. Ensure that you have the AWS Toolkit for VS Code [installed](setup-toolkit.md#setup-install).

1. Open an AWS SAM application, or [create one](sam-get-started.md#serverless-apps-create).

1. Open the folder that contains `template.yaml`.
**Note**  
When debugging a TypeScript Lambda function directly from the source code (launch configuration has `"target": "code"`), the TypeScript compiler must be installed either globally or in your project's `package.json`.

## Configure a toolchain for Python
<a name="setup-toolchain-for-python"></a>

1. Ensure that you have the AWS Toolkit for VS Code [installed](setup-toolkit.md#setup-install).

1. Install the [Python extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-python.python). This extension enables VS Code to debug Python applications.

1. Open an AWS SAM application, or [create one](sam-get-started.md#serverless-apps-create).

1. Open the folder that contains `template.yaml`.

1. Open a terminal at the root of your application, and configure `virtualenv` by running `python -m venv ./.venv`.
**Note**  
You only need to configure `virtualenv` once per system.

1. Activate `virtualenv` by running one of the following:
   + Bash shell: `./.venv/Scripts/activate`
   + PowerShell: `./.venv/Scripts/Activate.ps1`

## Configure a toolchain for Java
<a name="setup-toolchain-for-java"></a>

1. Ensure that you have the AWS Toolkit for VS Code [installed](setup-toolkit.md#setup-install).

1. Install the [Java extension and Java 11](https://marketplace.visualstudio.com/items?itemName=redhat.java). This extension enables VS Code to recognize Java functions.

1. Install the [Java debugger extension](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debug). This extension enables VS Code to debug Java applications.

1. Open an AWS SAM application, or [create one](sam-get-started.md#serverless-apps-create).

1. Open the folder that contains `template.yaml`.

## Configure a toolchain for Go
<a name="setup-toolchain-for-go"></a>

1. Ensure that you have the AWS Toolkit for VS Code [installed](setup-toolkit.md#setup-install).

1. Go 1.14 or higher is required for debugging Go Lambda functions.

1. Install the [Go extension](https://marketplace.visualstudio.com/items?itemName=golang.Go).
**Note**  
Version 0.25.0 or higher is required for debugging Go1.15\$1 runtimes.

1. Install Go tools using the [command palette](https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/toolkit-navigation.html#command-locations):

   1. From the command palette, choose `Go: Install/Update Tools`.

   1. From the set of check boxes, select `dlv` and `gopls`.

1. Open an AWS SAM application, or [create one](sam-get-started.md#serverless-apps-create).

1. Open the folder that contains `template.yaml`.

## Using Your toolchain
<a name="use-toolchain"></a>

Once you have your toolchain set up, you can use it to [run or debug](sam-get-started.md#serverless-apps-debug) the AWS SAM application.