You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: AI Training - Tutorial - Connect to VSCode via remote
2
+
title: AI Training - Tutorial - Connect to VSCode via Remote
3
3
excerpt: Tutorial to configure Remote Visual Studio with AI Training
4
-
updated: 2022-09-01
4
+
updated: 2025-09-05
5
5
---
6
6
7
7
## Objective
@@ -10,60 +10,146 @@ This tutorial covers the process of starting a job using a Visual Studio Code Re
10
10
11
11
## Requirements
12
12
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
19
17
20
18
## Installation
21
19
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).
25
23
26
-
## Start a job with the SSH feature
24
+
## Generate SSH Keypair
27
25
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:
29
27
30
-
```{.bash}
31
-
ovhai job run --gpu <nb-gpus> -s ~/.ssh/id_ed25519.pub ovhcom/ai-training-tensorflow:2.3.0
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
+
>> {.thumbnail}
53
+
>>
54
+
>> Fill in the various details required until you find the `Advanced configuration`{.action} section. Open it.
55
+
>>
56
+
>> {.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
+
>> {.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
+
>> {.thumbnail}
65
+
>>
66
+
>> Click on `Confirm`{.action}. Once your key is added, you can select it from your SSH Keys list:
67
+
>>
68
+
>> {.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
+
>> {.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.
35
93
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
39
98
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`):
41
100
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
+
```
43
104
44
-
```{.bash}
45
-
ssh <job-id>@gra.ai.cloud.ovh.net
105
+
If SSH key is well configured, you should see the following:
46
106
47
-
Welcome to OVHcloud AI Training Jobs SSH
48
-
job-0d916855-1cd4-4b66-8803-b4782bc13902:~$
49
107
```
108
+
Welcome to OVHcloud!
109
+
ovh@job-36ed1f18-626b-42f7-b15f-0ed844e65d20:~$
110
+
```
111
+
112
+
## Configure VSCode Remote Connection
50
113
51
-
Click on the Remote Explorer Button.
114
+
On Visual Studio Code, click on the `Remote Explorer`{.action} icon.
52
115
53
116
{.thumbnail}
54
117
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.
56
119
57
120
{.thumbnail}
58
121
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:
60
132
61
133
{.thumbnail}
62
134
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:
64
136
65
137
{.thumbnail}
66
138
139
+
If connection is well established, you should see this message in the bottom-left corner of VSCode:
140
+
141
+
{.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
+
{.thumbnail}
148
+
149
+
You can also open a terminal and run commands from it. Enjoy!
150
+
151
+
{.thumbnail}
152
+
67
153
## Go further
68
154
69
155
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
74
160
75
161
Please send us your questions, feedback and suggestions to improve the service:
76
162
77
-
- On the OVHcloud [Discord server](https://discord.gg/ovhcloud)
163
+
- On the OVHcloud [Discord server](https://discord.gg/ovhcloud)
0 commit comments