Help Center> ModelArts> DevEnviron> Local IDE> Local IDE (VS Code)> Connecting to a Notebook Instance Through VS Code with One Click
Updated on 2024-06-12 GMT+08:00

Connecting to a Notebook Instance Through VS Code with One Click

Prerequisites

  • The notebook instance with remote SSH enabled is running. For details, see Creating a Notebook Instance.
  • You have downloaded the key file of the instance to a following local directory or its subdirectory based on your operating system:

    Windows: C:\Users\{{user}}

    Mac or Linux: Users/{{user}}

Procedure

  1. Log in to the ModelArts management console. In the left navigation pane, choose DevEnviron > Notebook.
  2. The created notebook instance is running. Access a VS Code connection in either of the following ways: Click More in the Operation column and choose Access VS Code from the drop-down list. Alternatively, click Open in the Operation column. On the Launcher tab of the JupyterLab page, click VS Code. The Access VS Code dialog box is displayed.

    Figure 1 Accessing VS Code on the management console
    Figure 2 Accessing VS Code on the launcher page

  3. If you have installed VS Code, click Access VS Code. The Visual Studio Code page is displayed.

    Figure 3 Opening Visual Studio Code

    If VS Code has not been installed, click Windows or other OS as required to download and install VS Code. For details about how to install VS Code, see Installing VS Code.

    Figure 4 Downloading and Installing VS Code

  4. If the ModelArts VS Code plug-in has not been installed, click Install and Open. If you have installed the plug-in, perform 5.

    Figure 5 Installing the VS Code plug-in

    The installation takes about 1 to 2 minutes. After the installation is complete, a dialog box is displayed in the lower right corner. Then, click Reload Window and Open.

    This section uses VS Code 1.78.2 as an example. The Reload Window and Open dialog box may not be displayed when you install other versions of VS Code. In this case, perform 5.

    Figure 6 Reload Window and Open

    In the displayed dialog box, select Don't ask again for this extension and click Open.

  5. Remotely connect to a notebook instance.

    • Before the remote connection is executed, the system automatically searches for the key file. If the key is found, a new window will be displayed and the system connects to the instance. In this case, you do not need to select the key.
      Figure 7 Remotely connecting to a notebook instance

    • If the key file is not found, a dialog box is displayed. Select the correct key as prompted.

      The key file name cannot contain Chinese characters.

      Figure 8 Selecting a key file
    • If an incorrect key is selected, a message will be displayed. Then, select the correct key as prompted.
      Figure 9 Selecting the correct key file

      When the information shown in the following figure is displayed, the instance is accessed.

      Figure 10 Connection successful

      The following error message indicates that accessing the instance failed. In this case, close the dialog box and view the output logs in the OUTPUT window. Then, check the FAQs and locate the cause.

      Figure 11 Connection failed