Connecting VS Code to a remote GPU server is one of the most efficient ways to develop and train AI models. This guide walks you through the complete setup process.
Why Use VS Code with Remote GPU?
| Benefit | Description |
|---|---|
| Full IDE Experience | IntelliSense, debugging, Git integration on remote server |
| Local Resources | UI runs locally, only compute happens on GPU server |
| File Sync | Automatic synchronization between local and remote |
| Terminal Access | Integrated terminal connected to remote server |
| Extension Support | Most VS Code extensions work remotely |
Prerequisites
Before starting, ensure you have:
- VS Code installed on your local machine
- A cloud GPU instance running (e.g., from SynpixCloud)
- SSH credentials: hostname, port, username, and password/key
- Remote - SSH extension for VS Code
Step 1: Install Remote SSH Extension
- Open VS Code
- Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
- Search for "Remote - SSH"
- Install the extension by Microsoft
The extension ID is: ms-vscode-remote.remote-ssh
Step 2: Get Your GPU Server SSH Details
When you rent a GPU instance from SynpixCloud, you'll receive:
SSH Host: gpu-xxx.synpixcloud.com
SSH Port: 22222
Username: root
Password: your-password-hereNote: The port may vary. Always check your instance dashboard for the correct port.
Step 3: Configure SSH Connection
Option A: Quick Connect (Recommended for First Time)
- Press
F1orCtrl+Shift+Pto open Command Palette - Type "Remote-SSH: Connect to Host"
- Select "Add New SSH Host"
- Enter the connection string:
ssh root@gpu-xxx.synpixcloud.com -p 22222- Select the SSH config file to update (usually
~/.ssh/config) - Click "Connect" in the notification
Option B: Edit SSH Config Directly
Open your SSH config file and add:
Windows: C:\Users\YourName\.ssh\config
macOS/Linux: ~/.ssh/config
Host synpixcloud-gpu
HostName gpu-xxx.synpixcloud.com
Port 22222
User rootThen connect via Command Palette โ "Remote-SSH: Connect to Host" โ select "synpixcloud-gpu"
Step 4: Enter Password and Connect
- VS Code will open a new window
- Select the platform type (Linux)
- Enter your password when prompted
- Wait for VS Code Server to install on the remote machine
First connection takes 1-2 minutes while VS Code installs its server component.
Step 5: Open Your Project Folder
Once connected:
- Click "Open Folder" in the Explorer sidebar
- Navigate to your project directory (e.g.,
/root/projects/my-ai-project) - Click "OK" to open
You're now editing files directly on the GPU server.
Step 6: Configure Python Interpreter
For AI development, configure the Python interpreter:
- Press
Ctrl+Shift+Pโ "Python: Select Interpreter" - Choose the Python version on the remote server
- If using Conda, select the appropriate environment
Common Python paths on cloud GPU:
/usr/bin/python3
/root/miniconda3/bin/python
/root/miniconda3/envs/pytorch/bin/pythonStep 7: Install Essential Extensions (Remote)
Install these extensions on the remote server:
| Extension | Purpose |
|---|---|
| Python | Python language support |
| Pylance | Fast Python IntelliSense |
| Jupyter | Run notebooks in VS Code |
| GitLens | Enhanced Git integration |
Important: Extensions must be installed separately on the remote server. Click "Install in SSH: hostname" when prompted.
Using the Integrated Terminal
The VS Code terminal is now connected to your GPU server:
# Check GPU status
nvidia-smi
# Activate conda environment
conda activate pytorch
# Run your training script
python train.pyFile Transfer Tips
Upload Files to Server
- Drag and drop files from your local machine to the VS Code Explorer
- Or use the terminal with
scp:
# From local terminal (not VS Code terminal)
scp -P 22222 local_file.py root@gpu-xxx.synpixcloud.com:/root/projects/Download Files from Server
- Right-click file in Explorer โ "Download"
- Or use
scpfrom local terminal:
scp -P 22222 root@gpu-xxx.synpixcloud.com:/root/projects/model.pth ./Running Jupyter Notebooks
VS Code can run Jupyter notebooks directly on the remote GPU:
- Install the Jupyter extension (on remote)
- Open any
.ipynbfile - Select the kernel (Python interpreter)
- Run cells with Shift+Enter
Advantage: No need to set up port forwarding or Jupyter server manually.
Troubleshooting Common Issues
Connection Timeout
Symptom: "Could not establish connection"
Solutions:
- Verify the server is running (check SynpixCloud dashboard)
- Check if the port is correct
- Try connecting via regular terminal first:
ssh -p 22222 root@gpu-xxx.synpixcloud.comPermission Denied
Symptom: "Permission denied (publickey,password)"
Solutions:
- Double-check your password
- Ensure you're using the correct username (usually
root) - Check if the server allows password authentication
VS Code Server Installation Fails
Symptom: "Failed to install VS Code Server"
Solutions:
- Check disk space:
df -h - Check internet connectivity on server
- Try reconnecting after a few minutes
Extensions Not Working
Symptom: Extensions installed but not functioning
Solutions:
- Ensure extensions are installed on remote (not just local)
- Reload the VS Code window (Ctrl+Shift+P โ "Reload Window")
- Check extension compatibility with remote development
Slow Performance
Symptom: Typing lag, slow file operations
Solutions:
- Check network latency to server
- Disable unnecessary extensions
- Exclude large folders from file watching:
Add to .vscode/settings.json:
{
"files.watcherExclude": {
"**/data/**": true,
"**/checkpoints/**": true,
"**/.git/**": true
}
}Best Practices
1. Use SSH Keys Instead of Passwords
Generate and copy SSH key for passwordless login:
# Generate key (if you don't have one)
ssh-keygen -t ed25519
# Copy to server
ssh-copy-id -p 22222 root@gpu-xxx.synpixcloud.com2. Keep Sessions Alive
Add to SSH config to prevent disconnection:
Host synpixcloud-gpu
HostName gpu-xxx.synpixcloud.com
Port 22222
User root
ServerAliveInterval 60
ServerAliveCountMax 33. Use tmux for Long-Running Tasks
Training jobs should run in tmux to survive disconnections:
# Start new session
tmux new -s training
# Run your script
python train.py
# Detach: Ctrl+B, then D
# Reattach later
tmux attach -t training4. Set Up Workspace Configuration
Create .vscode/settings.json in your project:
{
"python.defaultInterpreterPath": "/root/miniconda3/envs/pytorch/bin/python",
"python.formatting.provider": "black",
"editor.formatOnSave": true,
"files.exclude": {
"**/__pycache__": true,
"**/*.pyc": true
}
}Alternative: PyCharm Professional
If you prefer PyCharm, it also supports remote development:
- Go to File โ Settings โ Project โ Python Interpreter
- Add Interpreter โ On SSH
- Configure SSH connection
- Select remote Python interpreter
Note: Remote development requires PyCharm Professional (paid). VS Code's Remote SSH is free.
Comparison: VS Code vs PyCharm for Remote GPU
| Feature | VS Code | PyCharm Professional |
|---|---|---|
| Price | Free | $199/year |
| Setup Complexity | Easy | Moderate |
| Performance | Lightweight | Resource-heavy |
| Jupyter Support | Excellent | Good |
| Debugging | Good | Excellent |
| Refactoring | Good | Excellent |
Recommendation: Start with VS Code (free and effective), switch to PyCharm if you need advanced debugging or refactoring.
Summary
Connecting VS Code to a cloud GPU via SSH provides a seamless development experience:
- Install Remote - SSH extension
- Configure SSH connection with your GPU server details
- Connect and open your project folder
- Install Python/Jupyter extensions on remote
- Start developing with full GPU access
This setup gives you the best of both worlds: local IDE comfort with remote GPU power.
Need a GPU server to connect to? Browse SynpixCloud's marketplace for RTX 4090, A100, and H100 instances ready in seconds.
