Integrating Remote GPUs into Your Local Development Environment with VSCode
Unlock the power of remote GPUs directly in Visual Studio Code! This tutorial guides you through harnessing cloud resources like RunPod for resource-intensive tasks while maintaining your preferred development environment. Learn to set up SSH connections and optimize VSCode for seamless remote de...


As developers, we often find ourselves in situations where our local machines just don’t have enough power for resource-intensive tasks like fine-tuning machine learning models. While solutions like Google Colab or SSH connections to remote servers exist, they often lack the comfort and familiarity of our favorite development environments. What if we could harness the power of remote resources while still enjoying the rich ecosystem of Visual Studio Code? In this tutorial, we’ll explore how to do just that using a cloud provider that offers virtual machines with powerful CPUs and GPUs.
For this guide, we’ll be using RunPod as our primary example. RunPod is a cloud computing platform that specializes in providing GPUs for machine learning and AI tasks. However, it’s worth noting that there are several alternatives in the market:
- Vast.ai: A marketplace for renting and lending GPUs, offering competitive prices for GPU compute power.
- DigitalOcean: A cloud infrastructure provider that offers a range of virtual machines, including some with GPUs, though their GPU offerings are more limited compared to specialized providers.
Each of these platforms has its strengths, and the choice depends on your specific needs and budget. This approach can be adapted to work with any of these providers or similar services.
Prerequisites
- Visual Studio Code installed on your local machine
- Basic familiarity with SSH and cloud computing concepts
- An account with a cloud provider (we’ll be using RunPod in this tutorial)
Let’s dive in!
Step 1: Create an SSH Key
The first step is to create an SSH key that will allow secure access to your remote machine.
- If you haven’t already, generate an SSH key pair on your local machine.
- Log in to your RunPod account (or your chosen cloud provider).
- Navigate to the account settings or SSH key management section.
- Add your public SSH key to authorize terminal access to your pods.

Step 2: Create a Suitable Virtual Machine
Next, we’ll set up a virtual machine (VM) with the computational resources we need.
- In your cloud provider’s dashboard, navigate to the section for creating new VMs or pods.
- Choose between GPU and CPU options based on your requirements.
- Select a configuration that suits your needs and budget.
For GPU-intensive tasks:

For CPU-focused work:

Step 3: Note the SSH Connection Information
Once your VM is created, you’ll need to note down the SSH connection details.
- Locate the SSH connection information for your newly created VM.
- Make note of the IP address and the SSH port number.

Step 4: Configure Visual Studio Code
Now that we have our remote machine set up, let’s configure VSCode to connect to it.
- Install the “Remote - SSH” extension in VSCode if you haven’t already.

- Open your SSH config file (usually located at
~/.ssh/config
) and add an entry for your new VM:
Host myrunpod
HostName <the IP of the VM>
User root
Port <the port of the VM>
IdentityFile ~/.ssh/<YOUR SSH PRIVATE KEY>
Replace the placeholders with your actual VM IP, port, and the path to your SSH private key.
Step 5: Connect to Your Remote VM from VSCode
With everything set up, you’re now ready to connect to your remote VM directly from VSCode.
- Open the Remote Explorer in VSCode (usually found in the left sidebar).

- Click on “Connect to Host…” in the dropdown menu.

- Select your configured SSH host from the list (in our example, it would be “myrunpod”).

- VSCode will now connect to your remote VM. This might take a moment for the first connection as it sets up the necessary components on the remote machine.
Step 6: Start Developing!
Congratulations! You’re now connected to your remote VM through VSCode. You can start working on your projects, leveraging the power of your cloud-based resources while enjoying the familiar VSCode interface and extensions. Happy coding, and may your remote development adventures be both productive and exciting!