Connecting to a Notebook Instance Through VS Code Toolkit
This section describes how to use the ModelArts VS Code Toolkit plug-in to remotely connect to a notebook instance.
Prerequisites
You have downloaded and installed VS Code. For details, see Installing VS Code.
Step 1 Install the VS Code Plug-in
- Search for ModelArts in the EXTENSIONS text box and click Install.
Figure 1 Installing the VS Code plug-in
- Wait for about 1 to 2 minutes.
Figure 2 Installation process
- After the installation is complete, check the message displayed in the lower right corner. If the ModelArts icon and remote SSH icon are displayed in the navigation pane on the left, the VS Code plug-in is installed.
Figure 3 Installation completion message
Figure 4 Installation completed
Step 2 Add More Regions
- Import the configuration file in the VS Code plug-in.
Contact the region operations company to obtain the YAML configuration file and host information. Open the VS Code plug-in, click , choose Import Region Profile, click From local file in the lower right corner, enter the path to the local YAML file, and press Enter.
Step 3 Log In to the VS Code Plug-in
- In the local VS Code development environment, click and User Settings, and configure the login information.
Figure 6 Logging in to the plug-in
Enter the login information and click Log in.- Name: Custom username, which is displayed only on the VS Code page and is not associated with any account.
- AK and SK: Access key pair. To create a key pair, choose , and click Create Access Key.
- Region: must be the same as that of the notebook instance to be remotely connected. Otherwise, the connection will fail.
- After the login, check the notebook instance list.
Figure 7 Login succeeded
Step 4 Create a Notebook Instance
- Create a notebook instance with remote SSH enabled, and download the key file to either of the following directories based on your OS:
macOS or Linux: Users/{{user}}
- A key pair is automatically downloaded after you create it. Securely store your key pair. If an existing key pair is lost, create a new one.
Create a notebook instance with remote SSH enabled. For details, see Creating a Notebook Instance.
Step 5 Access the Notebook Instance
- In the local VS Code development environment, right-click the instance name and choose Connect to Instance from the shortcut menu to start and connect to the notebook instance.
The notebook instance can either be running or stopped. If it is stopped, the VS Code plug-in starts the instance and then connects to it.
Figure 8 Connecting to a notebook instance
Alternatively, click the instance name. On the instance details page, click Connect. Then, the system automatically starts and connects to the notebook instance.Figure 9 Viewing details about a notebook instance
- When you connect to a notebook instance for the first time, the system prompts you in the lower right corner to configure the key file. In this case, select the local .pem key file and click OK.
Figure 10 Configuring the key file
- Wait for about 1 to 2 minutes until the notebook instance is accessed. After information similar to the following is displayed in the lower left corner of the VS Code environment, the connection is succeeded.
Figure 11 Connection succeeded
Related Operations
For details about uninstalling the VS Code plug-in, see Figure 12.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.