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-sshConfigure 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_ed25519Replace <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
- Open the Command Palette:
Ctrl+Shift+P(macOS:Cmd+Shift+P) - Type Remote-SSH: Connect to Host
- 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
VS Code handles port forwarding automatically via the Ports tab, replacing manual ssh -L tunnel commands:
- While connected, open the Terminal panel and select the Ports tab
- Click Forward a Port
- Enter the port number (e.g.,
8888for Jupyter,6006for TensorBoard) - VS Code creates the tunnel and opens a local URL; click to open in browser
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 ./logsin the remote terminal. - Large file transfers: use
scporrsyncfor bulk transfers. VS Code drag-and-drop file upload works better for small files.
What's next
- SSH Connection: Key setup and basic SSH access
- Jupyter Notebook: Browser-based Jupyter setup
- Networking: Dedicated IP, port access, and SSH tunneling
- Security Best Practices: Secure your development environment