I recently switched to a Chromebook full time (the awesome Pixelbook), and the first question I get asked is “How do you do any development work on it?”
While Chromebooks are getting more powerful local development (a la Crostini), I’ve actually been using Google Cloud Shell as my primary development environment. In fact, I haven’t opened a local shell for months now.
So far, the experience has been awesome, and I’ve learned a bunch along the way. I wanted to share some tips, here they are!
What is Google Cloud Shell
Cloud Shell is a free terminal that you can use for whatever you want, and it runs 100% in a web browser.
Click this link to open Cloud Shell: https://console.cloud.google.com/cloudshell
Seeing how most of my work requires the internet, I’m completely fine with being tied to a browser.
What does it come with?
Cloud Shell comes with most of the tools I use on a daily basis right out of the box. These include gcloud, node, kubectl, docker, go, python, git, vim, and more.
There is 5GB of persistent storage that is tied to your $HOME directory, and this is also completely free.
The other really nice thing is that you are automatically authenticated to the current Google Cloud project you’re working in. This makes setup super easy, everything just works!
Tips and Tricks
1. Running a web server (with auto-HTTPS for FREE!)
Most people developing cloud apps usually run a web server of some sort. Usually, you would run it locally and just type in “localhost” into your web browser to access it.
This is not possible with Cloud Shell, so the team created a neat “web preview” function that creates a URL on the fly to point to your local server.
You can open up any port from 2000 to 65000, and your web traffic will come through!
Warning: There is some transparent auth done behind the scenes, so the URL the Cloud Shell opens might not work if you give it to someone else. I’d recommend a tool like ngrok if you want to share your “localhost” connection remotely.
2. Get extra power with “boost mode”
By default, Cloud Shell runs on a g1-small VM, which can be under-powered for some tasks. You can easily upgrade to a n1-standard-1 by enabling “boost mode.” It’s like the TURBO button on an old PC, but this time it actually works 🙂
3. Edit your files with a GUI
Yes yes, vim and emacs and nano are great and all. But sometimes you just want a nice, comfortable GUI to work with.
Cloud Shell ships with a customized version of the Orion editor.
While its not as good as VS Code or Eclipse, its actually a fully featured editor and I feel quite productive with it!
4. Upload/Download files
If you have files locally you want to upload to cloud shell, just click the “Upload” button in the menu and choose your file.
To download files, run this inside Cloud Shell:
$ cloudshell dl <FILENAME>
And it will download the file!
5. Persist binary/program installations
Because Cloud Shell only persists your $HOME directory, if you install things that don’t come out of the box with Cloud Shell, chances are it will be gone the next time you use it.
If you install things with apt-get, there really is no good solution. However, if you are downloading the binary directly or are compiling from source, you can create a path in your $HOME directory (for example, /home/sandeepdinesh/bin) and add that to your PATH. Any binaries in this folder will run like normal, and they will be persisted between reboots.
Bonus: Open in Cloud Shell
If you have a git repository in a public place (like a public GitHub repo), you can actually create a link that will open the end user’s Cloud Shell and automatically clone the repo to their $HOME directory.
To provide a link to open a sample Git repository in Cloud Shell, you would need to use Markdown such as the following…cloud.google.com
Because it is all free, it is a great way to get someone up and running with your project without having to worry about their local machine!
I’ve had a ton of success using Cloud Shell as my primary dev environment. If you are using a Chromebook or if you just want a free Linux shell that you can access from any browser, I’d definitely check out Cloud Shell.
There are a ton of new features coming down the line as well, I’ll be sure talk about them when they come out!
A collection of technical articles published or curated by Google Cloud Platform Developer Advocates. The views expressed are those of the authors and don’t necessarily reflect those of Google.