AI Tools - Remote SSH Connection

Database di conoscenze

AI Tools - Remote SSH Connection


Icons/System/eye-open Created with Sketch. 304 viste 09.09.2025 Cloud / AI Deploy

Objective

This tutorial covers the process of starting a job using a Visual Studio Code Remote via SSH.

Requirements

Instructions

Installation

  1. Install an OpenSSH compatible SSH client if one is not already present.
  2. Install Visual Studio Code.
  3. Install the Remote Development extension pack.

Generate an SSH Keypair

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:

ssh-keygen -t ed25519 -C "your_email@example.com"
  • -t ed25519 creates a modern, secure key (recommended).
  • -C lets you add a label (usually your email) to identify the key.

This will create a private key (e.g., id_ed25519, not to share) and a public key (e.g., id_ed25519.pub) in your ~/.ssh/ directory.

Specify the SSH Key during AI Notebook or AI Training Job Creation

Here is how to add your SSH key to your AI Solution if you are using the OVHcloud Control Panel or the ovhai CLI:

First, go to the Public Cloud section of the OVHcloud Control Panel.

Select your Public Cloud project, then go to the AI & Machine Learning category in the left menu and choose AI Notebooks or AI Training section.

From there, click on the + Create a notebook or + Launch a job button to configure and create your AI Solution.

image

Fill in the various details required until you find the Advanced configuration section. Open it.

image

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 button:

image

This will open a window where you can put the content of your public key file (e.g., id_ed25519.pub):

image

Click on Confirm. Once your key is added, you can select it from your SSH Keys list:

image

Once selected, make sure to click on the + to confirm the addition of your key. You should see the following message: 1 of 10 SSH key configured.

image

To follow this part, make sure you have installed the ovhai CLI on your computer or on an instance.

When creating your AI resource using the ovhai CLI, specify the SSH public key using the --ssh-public-keys option, or -s shortcut:

ovhai job run <job_image> \
  --gpu <nb-gpus> \
  --ssh-public-keys ~/.ssh/id_ed25519.pub

Once the job is Running, you can see the sshUrl by getting your job information:

ovhai job get <job-id>

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.

In order to work, the deployed image needs to contain the bash binary and a glibc-based Linux (Ubuntu / Debian).

Verify you can connect to the SSH host

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):

ssh <job-id>@<region>.ai.cloud.ovh.net

If the SSH key is well configured, you should see the following:

Welcome to OVHcloud!
ovh@job-36ed1f18-626b-42f7-b15f-0ed844e65d20:~$

Configure VSCode Remote Connection

In Visual Studio Code, click on the Remote Explorer icon.

image

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.

image

Add the following section for your new host:

Host my_ai_training_job
HostName <region>.ai.cloud.ovh.net # Adapt to your resource location (gra, bhs)
User bfa1d77a-9746-4128-9974-f94139937927 # ID of your AI Training Job or AI Notebook
IdentityFile C:\Path\To\id_ed25519 # Path to your private key file (not .pub)

Save the config file. Then refresh remotes by clicking on this icon:

image

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:

image

If the connection is well established, you should see this message in the bottom-left corner of VSCode:

image

Develop and Run Your Code

Once connected, you can start developing and running your code in the default /workspace folder, by clicking on the Open folder blue button, and select /workspace.

image

You can also open a terminal and run commands from it. Enjoy!

image

Go further

You can compare AI models based on resource consumption, accuracy and training time. Refer to this tutorial.

If you need training or technical assistance to implement our solutions, contact your sales representative or click on this link to get a quote and ask our Professional Services experts for a custom analysis of your project.

Feedback

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

Articoli correlati