Cloud Shell provisions a Compute Engine virtual machine running a Debian-based Linux operating system for your temporary use. This virtual machine is owned and managed by Google Cloud, so will not appear within any of your GCP projects.
Cloud Shell instances are provisioned on a per-user, per-session basis. The instance persists while your Cloud Shell session is active; after an hour of inactivity, your session terminates and its VM is discarded. For more on usage quotas, refer to the limitations guide.
With the default Cloud Shell experience, you are allocated with an ephemeral, pre-configured VM and the environment you work with is a Docker container running on that VM. You can also customize your environment automatically on VM boot to ensure that your Cloud Shell instance includes your preferred tools.
Persistent disk storage
Cloud Shell provisions 5 GB of free
persistent disk storage mounted as
$HOME directory on the virtual machine instance. This storage is on
a per-user basis and is available across projects. Unlike the instance itself,
this storage does not time out on inactivity. All files you store in your
home directory, including installed software, scripts and user configuration
.vimrc, persist between sessions. Your
directory is private to you and can't be accessed by other users.
Cloud Shell also offers Ephemeral mode which is the Cloud Shell experience without persistent disk storage. With Ephemeral mode, you'll have faster startup times but all the files you create in your session are lost on session end.
When you make a Google Cloud API call or use a command-line tool that requires credentials (such as the Google Cloud CLI) with Cloud Shell for the first time, Cloud Shell prompts you to authorize. Click Authorize to allow the tool to use your credentials to make calls.
Refer to the Authorizing with Cloud Shell for more details.
Pre-configured environment variables
When Cloud Shell is started, the active project in
the Google Cloud console is propagated to your
inside Cloud Shell for immediate use.
environmental variable used by Application Default Credentials library support
to define the project ID, is also set to point to the active project in
the Google Cloud console. The environment variable
WEB_HOST points to the
hostname of your Cloud Shell VM which you can use to make HTTPS
requests to the environment.
Cloud Shell is globally distributed across multiple Google Cloud regions. When you first connect to Cloud Shell, you are automatically assigned to the closest available region. You can't pick your own region and if Cloud Shell doesn't pick the closest region, Cloud Shell tries to migrate your Cloud Shell VM to a closer region when your Cloud Shell VM isn't in use.
To view your current region, run the following command from a Cloud Shell session:
The Cloud Shell container image is updated weekly to keep prepackaged tools up to date. This means Cloud Shell always comes with the latest versions of the gcloud CLI, Docker, and other utilities.
When you set up a Cloud Shell session, you get a regular Unix user account with a username based on your email address. With this access, you have full root privileges on your allocated VM and can even run sudo commands, if you need to.
The Cloud Shell virtual machine instance has the following pre-installed tools:
|Linux shell interpreters||
|Linux utilities||Standard Debian system utilities|
|gcloud CLI and tools||
App Engine SDK
Google Cloud CLI including the gcloud CLI
|Build and package tools||
|Source control tools||
You can install additional software packages on the virtual machine instance
but the installation will not persist after the instance terminates unless you
install the software in your
$HOME directory or create a
The Cloud Shell virtual machine instance provides pre-installed language support for the following:
|Java||JRE/JDK 1.8 and 11|
|.NET Core||SDKs 2.0.0 and 2.1.502
Core runtimes 2.0.0 and 2.1.6
The default version of the Java environment is 11. To change the current Cloud Shell session to use version 1.8 of the JRE and JDK, enter the following at the Cloud Shell command prompt:
sudo update-java-alternatives -s java-1.8.0-openjdk-amd64 && export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
To change back to 11:
sudo update-java-alternatives -s java-1.11.0-openjdk-amd64 && export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/jre
If there's a problem in your
files, Cloud Shell immediately close after connection. Safe mode
restarts your Cloud Shell instance and logs you in as root,
allowing you to fix any issues in the files.
To open Cloud Shell in safe mode:
cloudshellsafemode=trueto the URL.
- In Cloud Shell, click , click Safe Mode, and then click Restart.
To permanently delete all files in your home directory and restore your Cloud Shell home directory to a clean state, you can reset your Cloud Shell VM.