Skip to content

Commit 71078db

Browse files
committed
update guide
1 parent 586eb3d commit 71078db

File tree

13 files changed

+116
-30
lines changed

13 files changed

+116
-30
lines changed
Lines changed: 116 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
title: AI Training - Tutorial - Connect to VSCode via remote
2+
title: AI Training - Tutorial - Connect to VSCode via Remote
33
excerpt: Tutorial to configure Remote Visual Studio with AI Training
4-
updated: 2022-09-01
4+
updated: 2025-09-05
55
---
66

77
## Objective
@@ -10,60 +10,146 @@ This tutorial covers the process of starting a job using a Visual Studio Code Re
1010

1111
## Requirements
1212

13-
- an **AI Training project** created inside a **Public Cloud** project
14-
- a [user for AI Training](/pages/public_cloud/ai_machine_learning/gi_01_manage_users)
15-
- installing the [OVHcloud AI CLI](/pages/public_cloud/ai_machine_learning/cli_10_howto_install_cli)
16-
17-
> [!warning]
18-
> The deployed image needs to contain the `bash` binary and a glibc-based Linux (Ubuntu / Debian)
13+
- Access to the [OVHcloud Control Panel](/links/manager)
14+
- An AI Notebook or AI Training Project created inside a [Public Cloud project](/links/public-cloud/public-cloud) in your OVHcloud account
15+
- An [AI user](/pages/public_cloud/ai_machine_learning/gi_01_manage_users)
16+
- [The OVHcloud AI CLI](/pages/public_cloud/ai_machine_learning/cli_10_howto_install_cli) installed on your computer
1917

2018
## Installation
2119

22-
1. Install an [OpenSSH compatible SSH client](https://code.visualstudio.com/docs/remote/troubleshooting#_installing-a-supported-ssh-client) if one is not already present.
23-
2. Install [Visual Studio Code](https://code.visualstudio.com/).
24-
3. Install the [Remote Development extension pack](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack).
20+
1. Install an [OpenSSH compatible SSH client](https://code.visualstudio.com/docs/remote/troubleshooting#_installing-a-supported-ssh-client) if one is not already present.
21+
2. Install [Visual Studio Code](https://code.visualstudio.com/).
22+
3. Install the [Remote Development extension pack](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack).
2523

26-
## Start a job with the SSH feature
24+
## Generate SSH Keypair
2725

28-
We will launch a job with the CLI, just choose the number of GPUs (`<nb-gpus>`) to use on your job and use the following command:
26+
If you don’t already have an SSH key, you will need to create one. To do so, open a Terminal / PowerShell, and run the key generation command:
2927

30-
``` {.bash}
31-
ovhai job run --gpu <nb-gpus> -s ~/.ssh/id_ed25519.pub ovhcom/ai-training-tensorflow:2.3.0
28+
```bash
29+
ssh-keygen -t ed25519 -C "[email protected]"
3230
```
3331

34-
Once the job is `Running`, you can see the `sshUrl` with *job get*:
32+
> [!primary]
33+
> - `-t ed25519` creates a modern, secure key (recommended).
34+
>
35+
> - `-C` lets you add a label (usually your email) to identify the key.
36+
37+
This will create a private key (e.g., `id_ed25519`, to not share) and a public key (e.g., `id_ed25519.pub`) in your `~/.ssh/` directory.
38+
39+
## Specify SSH Key during AI Notebook or AI Training Job Creation
40+
41+
Here is how to add your SSH key to your AI Solution if you are using the UI [OVHcloud Control Panel](/links/manager) or the `ovhai` CLI:
42+
43+
> [!tabs]
44+
> **Using the Control Panel (UI)**
45+
>>
46+
>> First, go to the `Public Cloud`{.action} section of the [OVHcloud Control Panel](/links/manager).
47+
>>
48+
>> Select your desired Public Cloud project, then go to the `AI & Machine Learning`{.action} category in the left menu and choose `AI Notebooks`{.action} or `AI Training`{.action} section.
49+
>>
50+
>> From there, click on the `+ Create a notebook`{.action} or `+ Launch a job`{.action} button to configure and create your AI Solution.
51+
>>
52+
>> ![image](images/manager-1.png){.thumbnail}
53+
>>
54+
>> Fill in the various details required until you find the `Advanced configuration`{.action} section. Open it.
55+
>>
56+
>> ![image](images/manager-2.png){.thumbnail}
57+
>>
58+
>> From there you will find a `SSH Public Keys` sub-section where you can add and configure new SSH keys by clicking on the `+ Configure an SSH Key`{.action} button:
59+
>>
60+
>> ![image](images/manager-3.png){.thumbnail}
61+
>>
62+
>> This will open a window where you can put the content of your public key file (e.g., `id_ed25519.pub`):
63+
>>
64+
>> ![image](images/manager-4.png){.thumbnail}
65+
>>
66+
>> Click on `Confirm`{.action}. Once your key is added, you can select it from your SSH Keys list:
67+
>>
68+
>> ![image](images/manager-5.png){.thumbnail}
69+
>>
70+
>> Once selected, make sure to click on the `+`{.action} to confirm the addition of your key. You should see the following message: `1 of 10 SSH key configured`.
71+
>>
72+
>> ![image](images/manager-6.png){.thumbnail}
73+
>>
74+
> **Using ovhai CLI**
75+
>>
76+
>> To follow this part, make sure you have installed the [ovhai CLI](/pages/public_cloud/ai_machine_learning/cli_10_howto_install_cli) on your computer or on an instance.
77+
>>
78+
>> When creating your AI resource using the `ovhai` CLI, specify the SSH public key using the `--ssh-public-keys` option, or `-s` shortcut:
79+
>>
80+
>> ```bash
81+
>> ovhai job run <job_image> \
82+
>> --gpu <nb-gpus> \
83+
>> --ssh-public-keys ~/.ssh/id_ed25519.pub
84+
>> ```
85+
>>
86+
>> Once the job is `Running`, you can see the `sshUrl` by getting your job information:
87+
>>
88+
>> ```bash
89+
>> ovhai job get <job-id>
90+
>> ```
91+
92+
Once your job is created, regardless of the method chosen, you will be able to copy your job id (e.g., `bfa1d77a-9746-4128-9974-f94139937927`), which will be needed in the following steps.
3593
36-
``` {.bash}
37-
ovhai job get <job-id>
38-
```
94+
> [!warning]
95+
> In order to work, the deployed image needs to contain the `bash` binary and a glibc-based Linux (Ubuntu / Debian).
96+
97+
## Verify you can connect to the SSH host
3998
40-
## Configure VSCode Remote Development
99+
Before continuing, you can verify you can access your job by running the following command from a terminal / PowerShell window, replacing `<job-id>` with the ID of your job and `<region>` with your resource location (e.g., `gra`, `bhs`):
41100
42-
Verify you can connect to the SSH host by running the following command from a terminal / PowerShell window replacing user\@hostname accordingly:
101+
```bash
102+
ssh <job-id>@<region>.ai.cloud.ovh.net
103+
```
43104
44-
``` {.bash}
45-
ssh <job-id>@gra.ai.cloud.ovh.net
105+
If SSH key is well configured, you should see the following:
46106

47-
Welcome to OVHcloud AI Training Jobs SSH
48-
job-0d916855-1cd4-4b66-8803-b4782bc13902:~$
49107
```
108+
Welcome to OVHcloud!
109+
ovh@job-36ed1f18-626b-42f7-b15f-0ed844e65d20:~$
110+
```
111+
112+
## Configure VSCode Remote Connection
50113

51-
Click on the Remote Explorer Button.
114+
On Visual Studio Code, click on the `Remote Explorer`{.action} icon.
52115

53116
![image](images/vscode-1.png){.thumbnail}
54117

55-
Then click on the `+` button to add a SSH server.
118+
From there, click the gear icon on the SSH feature to access the SSH configuration file for VSCode, typically located at `~/.ssh/config`, and open it.
56119

57120
![image](images/vscode-2.png){.thumbnail}
58121

59-
Then click on the window icon near your server in the list.
122+
Add the following section for your new host:
123+
124+
```
125+
Host my_ai_training_job
126+
HostName <region>.ai.cloud.ovh.net # Adapt to your resource location (gra, bhs)
127+
User bfa1d77a-9746-4128-9974-f94139937927 # ID of your AI Training Job or AI Notebook
128+
IdentityFile C:\Path\To\id_ed25519 # Path to your private key file (not .pub)
129+
```
130+
131+
Save the `config` file. Then refresh remotes by clicking on this icon:
60132

61133
![image](images/vscode-3.png){.thumbnail}
62134

63-
Enjoy.
135+
Your resource should now appear in the SSH menu on the left. Connect to it by clicking the arrow next to your resource. VSCode will restart to connect to your remote resource:
64136

65137
![image](images/vscode-4.png){.thumbnail}
66138

139+
If connection is well established, you should see this message in the bottom-left corner of VSCode:
140+
141+
![image](images/vscode-5.png){.thumbnail}
142+
143+
## Develop and Run Your Code
144+
145+
Once connected, you can start developing and running your code in the default `/workspace` folder, by clicking on the `Open folder`{.action} blue button, and select `/workspace`.
146+
147+
![image](images/vscode-6.png){.thumbnail}
148+
149+
You can also open a terminal and run commands from it. Enjoy!
150+
151+
![image](images/vscode-7.png){.thumbnail}
152+
67153
## Go further
68154

69155
You can compare AI models based on resource consumption, accuracy and training time. Refer to this [tutorial](/pages/public_cloud/ai_machine_learning/training_tuto_06_models_comparaison_weights_and_biases).
@@ -74,4 +160,4 @@ If you need training or technical assistance to implement our solutions, contact
74160

75161
Please send us your questions, feedback and suggestions to improve the service:
76162

77-
- On the OVHcloud [Discord server](https://discord.gg/ovhcloud)
163+
- On the OVHcloud [Discord server](https://discord.gg/ovhcloud)
212 KB
Loading
15.4 KB
Loading
55.6 KB
Loading
91.6 KB
Loading
64.2 KB
Loading
57.7 KB
Loading
119 KB
Loading
10.3 KB
Loading
-83.4 KB
Loading

0 commit comments

Comments
 (0)