Install the Cloud Code for VS Code extension

The Cloud Code for VS Code extension adds support for Google Cloud development to VS Code.

Before you begin

Before you install Cloud Code, confirm that the following tools are installed and set up on your system:

  1. Install and set up Visual Studio Code on your machine.
  2. Install and configure language support.

    The Cloud Code extension works best with the following languages:

  3. Install Git. Git is required for copying samples to your machine.

  4. Install the Docker client and add it to the PATH environment variable:

    • If you're building exclusively using Cloud Build or Jib, you can skip installing Docker.
    • If you're using Windows Home, for steps to set up your Docker client, see Docker Desktop for Windows Home guide.
    • If you're using WSL but can't install Docker for Desktop, use minikube instead for local development with Cloud Code.
  5. If you're using Google Cloud, create a Google Cloud project and then enable billing.

    Projects allow you to collect the related resources for a single application in one place, manage APIs, enable Google Cloud services, add and remove collaborators, and manage permissions for Google Cloud resources.

Installing Cloud Code

  1. Install the extension from the Visual Studio Code Marketplace.

    Alternatively, open the Extensions view in VS Code by clicking Extension icon Extensions or pressing Ctrl/Cmd+Shift+X, search for the Cloud Code extension, and then click Install.

    If you're running Cloud Code on Apple M-series silicon, you're prompted to install Rosetta 2. This allows Cloud Code to automatically install some command-line dependencies. If you prefer not to install Rosetta 2, follow the steps in Custom versions of dependencies to install the dependencies manually. For more information, see Cloud Code support for Apple M-series silicon.

  2. If prompted, restart VS Code.

    After the extension has successfully installed, the Cloud Code icons are added to the left side activity bar and ready for use. You can further configure your Cloud Code installation by specifying your preferences using the top-level application taskbar: Code > Preferences > Settings > Extensions > Cloud Code.

Custom versions of dependencies

By default, Cloud Code has Auto dependencies turned on and installs some command-line dependencies for you automatically. If you turn off auto dependencies, you can use custom versions of the dependencies but you must install the dependencies yourself for Cloud Code to work.

To use custom versions of Cloud Code dependencies:

  1. Click Manage icon Manage > Settings and then set Auto Dependencies (cloudcode.autoDependencies) to off.
  2. Install the following dependencies on your PATH:

Authentication with Google Cloud

To help with application development with Google Cloud APIs, when you log in to the gcloud CLI, your Application Default Credentials are updated.

Logging in to Google Cloud

If you aren't logged in to Google Cloud, follow these steps to log in:

  1. Click Cloud Code icon Cloud Code and then expand a section. For example, click Cloud Run.
  2. Click Log in to Cloud SDK. Follow the prompts to log in using your web browser.

Logging out of Google Cloud

In a Cloud Code view, such as the Cloud Run section, hover over the project name, click Sign out of Google Cloud CLI Sign out of Cloud SDK, and then click Sign out.

To log out using the Command Palette, open the Command Palette by pressing Ctrl/Cmd+Shift+P and then click Sign out of all accounts in Cloud SDK.

Change the active Google Cloud project

  1. In the VS Code status bar, next to the current project name, click Switch Project Switch Project.
  2. Select a project or enter keywords in the search bar to filter projects.

What's next

Getting Support

To send feedback, report issues on GitHub, or ask a question on Stack Overflow.