Consistent Work Environment? Cloud Workstations!

Raju Dawadi
5 min readMay 20, 2023

--

During older “setting up environment using Docker” days, we used to say “with Docker, we get consistent environment between local and production environment”. But still setting up the local environment for new team member used to take 2–3 days or a week. The difference and hurdle is not only the type of OS but also IDE, plugins, interaction with cloud services, libraries setup etc.

Here we are more “Cloud Native”!!!

Imagine a scenario where developer could onboard in few hours. No need to onboard on every single requirement, no matter the person uses Docker or not, no local installation guide and license for IDE, no plugins/extensions installation in IDE, no service account tokens for cloud authentication. Yes, I tested it and it works like charm!

Cloud Workstations it is, on Google Cloud. Now, you write code in the cloud. That need not to be only on browser but also just as you code on your local machine with the code being saved to the cloud. There are other options I see for this type apart from GCP Cloud Workstations, like, Github Codespaces, Jetbrains Fleet. What I specially liked about the Workstations is flexibility. The flexibility in terms of:

  1. We get to choose which IDE to use. The ones available already are: Code OSS, Rider, Intellij IDEA, WebStorm, PhpStorm, RubyMine, GoLand, CLion. Also, we can have our own docker image as base with IDE and required plugin.
  2. Choosing instance type is our choice along with disk space. Starting from 2vCPU/4GB instance to 60vCPU/240GB and disk space up to 1000GB. And we pay for these instance on demand.
  3. Out of the box cost savings feature in case of inactivity. No worries to get charged if you leave the machine idle for half an hour or up to 4 hours. The machine gets turned off and we won’t be charged for the compute(disk space will be charged). For faster boot up, we can leave one idle instance running, otherwise the machine will get up and running in about a minute when you hit the browser IDE URL or start connection from local IDE(connect over SSH).
  4. Access to shell: May it be through the IDE console itself or direct ssh. Want to install any specific package, gcloud beta workstations ssh… is there.
  5. Access to custom port: Suppose you are developing a django app and want to test it on port 5000, there’s port forwarding option and the access to the test URL. Also, we can keep the whole workstations inside private network. Means, no worries if the user needs to connect to private resource in Google Cloud, like connecting to redis running inside Compute Instance in private network. Simple as that.

How much does Cloud Workstations cost?

There’s fee for control plane and the compute is on-demand pricing based on the instance or cluster configuration we choose. A control plane fee of $0.20 / hour is charged. Means, it’s bit pricey but I expect one cluster to be free just like GKE(monthly free credits for 1 GKE cluster per billing account) which will be better for single user.

How to create Cloud Workstations and access it?

First of all, we need to create Cluster(non-editable later) specifying the region, and network settings specifying the network & sub-network we want to use and the gateway type of private or public(still needs IAM access).

Once the Cluster is created, the next part is Cluster Configurations where we specify the Cluster to use, the type of instance & Code Editor to use, disk space, pool size, turn off period after inactivity(0.5 to 4 hrs), encryption key for VM and disk, and IAM access.

Now we are ready to launch cluster by giving Workstation name and configuration to use 🚀.

My Workstations

I started with two of these: one is Code OSS which I can access via URL and the next one is Intellij IDEA Ultimate for which I need to install JetBrains Gateway through which I could connect to the workstation and code my local JetBrains IDE.

If JetBrains is not a preferred choice, we can connect to the cloud via VS Code or other code editors via ssh proxy. Hope plugin for VS code will be available soon that will make connection easier.

My 2 Cents

I have been working on Cloud Workstations for a while(I have got credits as Google Developer Expert — GDE. YAY!!) and has got good impression. I need not to worry about where my laptop is, I can code online from any computer/mobile. It’s easy to access GCP services without the local configuration and access controls. I am on MAC and some of the package installation sometimes slows me down but with the linux instance in the cloud, that too is solved.

When working on a shared project or aiming to collaborate on a single codebase, I find it convenient to share access to a workstation instance. This allows us to collaborate seamlessly in real time, enabling efficient teamwork and code sharing.

In regard to cost, there is one drawback to consider. We are required to pay for the control plane, and it would be advantageous if GCP could offer credits for at least one cluster per billing account. This would benefit individual users like myself. To mitigate costs, I need not to turn off the instance but it will go off after half an hour of inactivity. This ensures that I won’t be charged excessively when the compute resources are not in use or when I’m away from the system.

--

--