You’ll find yourself switching between your code editor and terminal frequently when you develop services using Compute Engine. This customizable compute service allows you to create and run virtual machines on Google’s infrastructure.
Cloud code is a collection of IDE plugins that are compatible with popular IDEs such as IntelliJ and VS Code. It makes it easier to create applications that use Google Cloud services. Cloud Code allows you to easily integrate common workflows into your favorite IDE’s user interface, making it easier to use Compute Engine.
This integration between Compute Engine & Cloud Code allows you to view information about your virtual machines, connect to them via SSH, upload your files, and view their logs.
Before you begin
Let’s see how the new integration works with Cloud Code for VS Code. Download Cloud Code for VS Code and, once it is installed, find the “Compute Engine” icon in the activity bar to the left.
You could install Cloud Code for Jetbrains IDEs, such as IntelliJ, similarly. Compute Engine will be listed in your IDE tool window list.
View your VMs
Cloud Code allows you to view all relevant VMs within your GCP project, and view the details required to work with each VM in the IDE. Navigate to Cloud Code’s Compute Engine Explorer to get started working with a Compute Engine VM within the IDE. You can view all the VMs within your Cloud project by clicking on them. Clicking on a VM displays details like machine type, boot images, IP address, and more. Right-click on a VM to access the Google Cloud Console, where you can perform additional actions.
SSH to connect to your virtual machines
Cloud Code makes it simple to connect to the VM via SSH once you have found it. Find the VM that you wish to connect to again in Cloud Code’s Compute Engine explorer. Right click on it and choose “Open SSH”. Cloud Code will establish an SSH connection between your IDEs terminal and the VM. Cloud Code will run a troubleshooting scan to determine if there is any difficulty in setting up a connection.
Many organizations have VMs without a public IP address. This makes it difficult to establish SSH connections to them. Cloud Code can securely connect to VMs using Identity Aware Proxy even without a public IP.
Upload files to your VMs
It is possible to run a script or test a debug version in production. This will be done on a development VM instance that might not have full access to the source code, or not part of your CI/CD pipeline. Cloud Code allows you to upload your code files directly into a VM instance.
Cloud Code’s Compute Engine explorer will locate the VM that you wish to connect to, then right-click it and choose “Upload File via SSL”. Cloud Code will upload a file from your local computer to a VM instance via SCP. Cloud Code will open a new SSH tunnel to allow you to access files and to work on remote VM instances once upload is complete. Cloud Code will run a troubleshooting scan to determine if the connection is not working.
Check out your VM logs
You can right-click your VM to open the logs. This will open a log viewer in Visual Studio Code. The logs viewer in Cloud Console will open from IntelliJ. These logs viewers can be used to view configured application logs that are being collected with Cloud Logging.
Get Started
Compute Engine with Cloud Code is available to streamline your development workflow. For more information, see the Compute Engine documentation Visual Studio code and JetBrains IDEs . You can start your journey to development using IDEs by installing Visual Studio Code and IntelliJ.