Skip to content

VS Code Remote SSH

Connect VS Code directly to a Spheron GPU instance. IntelliSense, debugging, extensions, and the Ports panel run against the remote environment.

Prerequisites

  • VS Code installed locally
  • Remote - SSH extension (ms-vscode-remote.remote-ssh)
  • A running Spheron instance with SSH access configured

Install the extension from the VS Code Extensions panel or run:

code --install-extension ms-vscode-remote.remote-ssh

Configure SSH Host

Add your instance to ~/.ssh/config on your local machine:

Host spheron-gpu
    HostName <instance-ip>
    User <user>
    Port <port>
    IdentityFile ~/.ssh/id_ed25519

Replace <instance-ip>, <user>, and <port> with the values from the SSH command in the instance details panel in the dashboard. Connection details vary by provider:

  • Spheron AI: User ubuntu, Port 22
  • Voltage Park / TensorDock: uses a non-standard SSH port; use the values from the dashboard
  • Sesterce / DataCrunch / Massed Compute: Port 22 (username varies by provider; check the dashboard)

Replace ~/.ssh/id_ed25519 with the path to your private key.

Connect

  1. Open the Command Palette: Ctrl+Shift+P (macOS: Cmd+Shift+P)
  2. Type Remote-SSH: Connect to Host
  3. Select spheron-gpu

VS Code opens a new window connected to the remote instance. The status bar shows SSH: spheron-gpu when connected.

Install Remote Extensions

Once connected, install extensions inside the remote session so they run on the GPU instance rather than your local machine:

  • Python (ms-python.python): remote IntelliSense, debugging, test runner
  • Jupyter (ms-toolsai.jupyter): run notebooks directly in VS Code
  • PyTorch Snippets: code completion for PyTorch APIs

Search for these in the Extensions panel while connected to the remote host; VS Code automatically installs them on the instance.

Port Forwarding (No SSH Tunnels Needed)

VS Code handles port forwarding automatically via the Ports tab:

  1. While connected, open the Terminal panel → select the Ports tab
  2. Click Forward a Port
  3. Enter the port number (e.g., 8888 for Jupyter, 6006 for TensorBoard)
  4. VS Code creates the tunnel and opens a local URL; click to open in browser

This replaces manual ssh -L tunnel commands for development workflows.

Dev Containers (Optional)

Add a .devcontainer/devcontainer.json file to your project to define a container-based development environment with CUDA pre-installed:

{
  "name": "GPU Dev Container",
  "image": "nvcr.io/nvidia/pytorch:24.01-py3",
  "runArgs": ["--gpus", "all"],
  "customizations": {
    "vscode": {
      "extensions": [
        "ms-python.python",
        "ms-toolsai.jupyter"
      ]
    }
  },
  "postCreateCommand": "pip install -r requirements.txt"
}

VS Code builds and attaches to the container automatically when you open the project folder. GPU passthrough is enabled via --gpus all.

Tips

  • IntelliSense indexes the remote environment: after installing Python/Jupyter extensions, run the Python: Select Interpreter command and choose the environment where your packages are installed
  • TensorBoard: forward port 6006 via the Ports tab, then run tensorboard --logdir ./logs in the remote terminal
  • Large file transfers: use scp or rsync for bulk transfers; VS Code's drag-and-drop file upload is better for small files

Additional Resources