# Using VS Code with GCP VMs

[Visual Studio Code](https://code.visualstudio.com/) has a useful feature of allowing you to develop code on a remote VM from the convenience of your desktop. You can follow the steps below to configure your development environment for this task.

## Prerequisites

* \`\`[`gcloud` SDK](https://cloud.google.com/sdk/docs/install) installed on your computer
* [Visual Studio Code](https://code.visualstudio.com/) installed on your computer
* A GCP VM you want to use for code development is up and running

## **Step 1: Install "Remote - SSH" extension**

![](https://1103581492-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MCTG4fXybYgGMalZnmf-2668963341%2Fuploads%2Fgit-blob-e71bcbca44425927fd165d5c2c7230f787e129fb%2Fimage.png?alt=media)

## **Step 2: Populate SSH config files**

Run the following command to populate SSH config files with host entries for each VM instance you have running

```bash
$ gcloud compute config-ssh
```

## Step 3: Connect to host

If the previous step completed successfully, you should see the running VMs in the Remote Explorer of VS Code, as in the screenshot below, and should be able to open a new session to those remove VMs.

![](https://1103581492-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MCTG4fXybYgGMalZnmf-2668963341%2Fuploads%2Fgit-blob-bc9c8cfe96f661f1442558769846e6b599cccaea%2Fimage.png?alt=media)

{% hint style="warning" %}
Note that the SSH configuration may/will change if you restart your VM. In this case you will need to re-configure (re-run step 2 above).
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://learn.canceridc.dev/cookbook/virtual-machines/using-vs-code-with-gcp-vms.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
