Google Cloud Shell as a Development Environment

Thanks to [this article on Medium](https://medium.com/google-cloud/no-localhost-no-problem-using-google-cloud-shell-as-my-full-time-development-environment-22d5a1942439) I recently found out that Google Cloud Shell can also be a pretty decent development environment depending on your use case.

# What is the Cloud Shell?

Cloud Shell is a Linux terminal available on the Google Cloud Platform (GCP). As its main goal, Cloud Shell allows you to manage your projects and resources on GCP in your web browser, without having to install the Google Cloud SDK or other tools on your machine.

When Cloud Shell is started, a pre-configured virtual machine running a Debian-based Linux operating system is provisioned and you are given access to a Docker container running on top of that. So, we can use Cloud Shell for many of the things we would use such a machine for, but with some limitations, as explained later.

# Using the Cloud Shell

You can open the Cloud Shell with an icon in the top bar:

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/509832/86b240dd-5c6e-6ffc-7deb-8b748da7f9cd.png)

After a couple of seconds, it will be available to you:

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/509832/c9bf1606-9415-7586-89c9-3199025a4cc3.png)

## Editor

You can press the icon shown in the previous image to open the Editor. It is very basic, but it should be enough for many use cases.

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/509832/18e3681c-7c58-90b8-9a2b-ec520c710354.png)

## Web Preview

In the example below, I'm running [a sample application from the Cloud Shell documentation](https://cloud.google.com/shell/docs/deploying-an-app-engine-app) that starts a web application on port 8080.

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/509832/76583e51-ad29-8550-79ee-154b177638e0.png)

You can preview the application by accessing the "Web Preview" icon above. It will open the application in a new browser tab:

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/509832/c8d02097-fd36-1729-d6e5-f6244d5a901b.png)

# Features and Pros

As shown in the previous section, we have a pretty capable development environment running in a web browser that we can use for free. 

With Cloud Shell, we are provided with 5 GB of persistent disk storage tied to our $HOME directory. So, keep in mind that only files in your home directory persist between sessions (see Limitations).

What also makes Cloud Shell very convenient is the fact that it comes with many tools pre-installed, such as `gcloud`, `kubectl`, `mysql`, `git`, `vim`. And also, with development and deployment tools for Java, Go, Python, Node.js, PHP, and Ruby.

## Boost Mode

Cloud Shell also has a feature called "Boost Mode". I don't see myself using it much as I tend to run simpler applications on this environment, but it basically increases the specs of the underlying virtual machine for the next 24 hours. It changes the VM's machine type from the default `g1-small` (0.5 vCPU / 1.70 RAM) to a `n1-standard-1` (1 vCPU / 3.75 RAM).

To activate boost mode, find the 'Enable Boost Mode' option under the 'More' menu (the three dotted icon on the top right of Cloud Shell).

# Limitations

Now, let's talk about limitations as these are what will ultimately determine whether or not this tool is suited for your use cases or not.

*  Weekly Quota - Cloud Shell's usage is limited to 50 hours a week and you can check your remaining time through an option in the menu.

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/509832/6794b09a-e0ff-ce56-e979-ee8f6da466d4.png)

*  Ephemeral Storage - As said before, you have only 5GB of storage available and it is tied to your home directory. Because you are allocated an ephemeral virtual machine, any modifications made to it outside the home folder are lost after the instance is terminated (if the sessions is inactive for an hour, for example).

These are what I consider the main limitations, but you can read more about the topic in the [documentation](https://cloud.google.com/shell/docs/limitations).

# Alternatives

Although Cloud Shell is not marketed as a Cloud IDE, it can be used as such, so I'd like to briefly mention other tools we can use instead.

*  AWS Cloud9 - probably the first tool that comes to mind of most people when we talk about Cloud IDEs. I really have nothing bad to say about it as a tool; it's feature complete and I had no problems using it. Its pricing model is tied to the usage of the EC2 instance used to run it, so the price is variable according to your usage. It is highly recommended, especially if you are free-tier eligible.
*  Codeanyhwere - this is another tool I used quite a bit. I had no problems with it in terms of features and it has a very reasonable pricing model if you want more resources. But, I don't recommend it much due to reliability issues I had. The last time I used it, I had to start a container from scratch because it got stuck in a state that I couldn't access it anymore. Also, it continued to consider deleted containers in my quota.
*  Codenvy - I didn't use this one so much, but it looked good to me in terms of features. I can't say much about it in terms of reliability, but you may try it yourself as the free plan is more than enough for many use cases.

# Conclusion

Although Cloud IDEs didn't reach the domination suggested by some predictions, I feel they still have their use cases. One scenario where they are very well suited are coding workshops when you want to standardize everyone's environments and get up and running fast and without issues due to the differences in each person's platform. Nowadays, you also find them frequently associated with the use of Chromebooks for development.

In my case, I feel Cloud IDEs are convenient for simpler projects that I want to be able to use in different machines. And Cloud Shell suits this simple need for free with the additional convenience that I'm always logged in to Google services no matter the device I'm using.

# References

*  [No localhost? No problem! Using Google Cloud Shell as my full time development environment.](https://medium.com/google-cloud/no-localhost-no-problem-using-google-cloud-shell-as-my-full-time-development-environment-22d5a1942439)
*  [How Cloud Shell works](https://cloud.google.com/shell/docs/how-cloud-shell-works)
*  [Preview and deploy an App Engine application](https://cloud.google.com/shell/docs/deploying-an-app-engine-app)
*  [Limitations and restrictions](https://cloud.google.com/shell/docs/limitations)