

# VS Code Setting in Amazon SageMaker Unified Studio


Follow the steps described in these sections to integrate Amazon SageMaker Unified Studio in VS code:

**Topics**
+ [

## Authenticating directly in Local IDE
](#local-ide)
+ [

# Link to VS Code from Amazon SageMaker Unified Studio
](link-to-vs-code.md)

## Authenticating directly in Local IDE


**In Identity Center based domains**

1. Open the AWS Toolkit panel in VS Code and navigate to the Amazon SageMaker Unified Studio section.

1. Choose Sign in to get started. You will see 2 options to sign in with IAM Credentials and IAM Identity Center. Choose IAM Identity Center and enter your domain URL (format: `https://domain-id.sagemaker.region.on.aws`).

1. You will see a prompt asking you to open a link in the browser for IAM Identity Center authentication, choose Open on the Do you want Code to open the external website? prompt. You will be directed to the browser AWS IAM Identity Center authentication. Complete the authentication flow in your browser, choose Allow access on the next prompt, and return to VS Code.

1. You should now be prompted to select a project. If not, under the domain, choose Select a project to choose from the list of available projects in your domain.

1. Once connected, you'll see a hierarchical view of your resources. Under the selected Project, you have Data and Compute resources associated with the project.

**In IAM-based domains**

1. Open the AWS Toolkit panel in VS Code and navigate to the Amazon SageMaker Unified Studio section.

1. Choose Sign in to get started. You will see 2 options to sign in with IAM Credentials and IAM Identity Center. Choose IAM Credentials.

1. You can either choose an existing credential profile and edit it or create a new one.
   + To edit an existing credential profile, follow the process in [AWS IAM credentials](https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/setup-credentials.html).
   + To create a new credential profile, follow the prompts and provide the credential of the Login Role you use to access your project in Amazon SageMaker Unified Studio IAM-based domain.
     + Select the region where your IAM-based domain is in. After the profile is created, sign in by selecting the created profile.

1. You will then see your Amazon SageMaker Unified Studio resources including Data and Compute resources listed in a sub-panel within AWS Toolkit.

The resources under Data show all your project's data sources: S3 buckets, Redshift, and Lakehouse in one place, with easy browsing through databases, tables, and schema. You can access the data schema directly without switching between different tools or screens, making it easy for code authoring in VS Code.

The Compute resource has Data warehouse, Data processing, and Spaces within each project. Data Warehouse and Data Processing list the compute connections in the project and hovering over them displays the connection metadata. Spaces are remote IDE environments you have access to in the project that you can connect to remotely to author code from your local VS Code IDE.

# Link to VS Code from Amazon SageMaker Unified Studio


You can use Open in VS Code link provided in Amazon SageMaker Unified Studio to access your SageMaker Space in VS Code. When you choose this option, Amazon SageMaker Unified Studio will open VS Code on your system and open your SageMaker space in VS Code. 

**Note**  
You must be using AWS Toolkit version 3.87 or higher for Open in VS Code to function. 

**In Identity Center based domains:**

1. Navigate to Amazon SageMaker Unified Studio using the URL from your admin and log in using your SSO credentials.

1. Expand the Build menu in the top navigation, then choose JupyterLab.

1. Once your JupyterLab Notebook opens, choose Open in VS Code in the top right corner of the page.

**In IAM-based domains:**

1. Navigate to Amazon SageMaker Unified Studio using the URL from your admin and log in using your IAM credentials.

1. In the left navigating, choose JupyterLab

1. Once your JupyterLab Notebook opens, choose Open in VS Code in the top right corner of the page. This will establish a remote connection and open your SageMaker space in VS Code.

**Note**  
The sessions initiated through Open in VS Code link do not automatically reconnect if the remote session is interrupted. You will need create a new remote connection using the Open in VS Code link in Amazon SageMaker Unified Studio. The sessions established through this link can last for 12 hours if not interrupted. 