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:
- Install and set up Visual Studio Code on your machine.
Install and configure language support.
The Cloud Code extension works best with the following languages:
Install Git. Git is required for copying samples to your machine.
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.
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.
Install Cloud Code
Install the extension from the Visual Studio Code Marketplace.
Alternatively, open the Extensions view in VS Code by clicking
Extensions or pressing
Ctrl
/Cmd
+Shift
+X
, search for the Cloud Code extension, and then click Install.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:
- Click
cloudcode.autoDependencies
) tooff
.
Manage > Settings and then set Auto Dependencies
( Install the following dependencies on your
PATH
:- kubectl
- Skaffold
- minikube for local development
- Google Cloud CLI, if developing with Google Cloud
Optional: Verify Cloud Code vsix using VsixSignTool
To verify the Cloud Code vsix with the VsixSignTool, perform the following steps:
Ensure you're using the following:
- Nuget package manager
- Windows OS
- A production release of Cloud Code
Install the Microsoft VsixSignTool and take note of the installation path.
Open VS Code and navigate to
Extensions > Cloud Code.
In the Details tab, under Extension Resources, click Marketplace.
On the Marketplace page in your browser, under Resources, click Download Extension to download the packaged version of Cloud Code. This downloads the packaged version of Cloud Code, which has a
.vsix
file extension, to your default download directory.If you'd prefer to verify a different version than the latest, click the Version History tab and select a different version to download.
When the download is complete, open a terminal window and run the following:
PATH_TO_VSIXSIGNTOOL verify PATH_TO_DOWNLOADED_VSIX
Confirm that the output matches the following:
VsixSignTool Success: Package PATH_TO_DOWNLOADED_VSIX is valid.
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.
Log in to Google Cloud
If you aren't logged in to Google Cloud, follow these steps to log in:
- In the status bar, next to Cloud Code, click Connect to Google Cloud.
- Follow the prompts to log in using your web browser.
Log out of Google Cloud
- Click
Cloud Code and then expand Help and Feedback.
- Click Sign Out of Google Cloud and when prompted, select Sign-out.
- Alternatively, you can log out using the Command Palette. Press
Ctrl
/Cmd
+Shift
+P
or click View > Command Palette, and then click Sign out of all accounts in Google Cloud SDK.
Change the active Google Cloud project
- In the VS Code status bar, next to the current project name, click
Switch Project.
- Select a project or enter keywords in the search bar to filter projects.