Run gcloud
commands with Cloud Shell
Learn how to run gcloud CLI commands in Cloud Shell.
To follow step-by-step guidance for this task directly in the Cloud Shell Editor, click Guide me:
Before you begin
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
Set gcloud
properties
- Launch the Cloud Shell Editor.
Prevent color from being used when printing messages to the terminal by setting a core property:
gcloud config set disable_color true
Unset the
disable_color
property:gcloud config unset disable_color
If you have the Compute Engine API enabled, set your preferred Compute Engine region. Replace
REGION
with a region name—for example,us-east1
:gcloud config set compute/region REGION
Alternatively, you can set your preferred zone. Replace
ZONE
with a zone name—for example,us-east1-b
:gcloud config set compute/zone ZONE
For information about Compute Engine regions and zones, see Regions and zones.
Display a list of available properties:
gcloud topic configurations
Run core commands
List accounts whose credentials are stored on the local system:
gcloud auth list
The gcloud CLI displays a list of credentialed accounts, where
ACCOUNT_EMAIL
represents a list of one or more active accounts:Credentialed Accounts ACTIVE ACCOUNT \*
ACCOUNT_EMAIL
List the properties in your active gcloud CLI configuration:
gcloud config list
The gcloud CLI displays the list of properties similar to the following, where
ACCOUNT_EMAIL
andPROJECT_ID
display your email and project ID:[core] account = ACCOUNT_EMAIL disable_usage_reporting = False project = PROJECT_ID
View information about your gcloud CLI installation and the active configuration:
gcloud info
View help for gcloud
commands
View the help for the
gcloud compute instances create
command:gcloud help compute instances create
View available commands under
gcloud topic
:gcloud help topic
View information on filtering:
gcloud topic filters
Learn more about
gcloud
command structure:gcloud topic command-conventions