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.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify 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.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify 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 trueUnset the
disable_colorproperty:gcloud config unset disable_colorIf you have the Compute Engine API enabled, set your preferred Compute Engine region. Replace
REGIONwith a region name—for example,us-east1:gcloud config set compute/region REGIONAlternatively, you can set your preferred zone. Replace
ZONEwith a zone name—for example,us-east1-b:gcloud config set compute/zone ZONEFor 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 listThe gcloud CLI displays a list of credentialed accounts, where
ACCOUNT_EMAILrepresents a list of one or more active accounts:Credentialed Accounts ACTIVE ACCOUNT \*
ACCOUNT_EMAILList the properties in your active gcloud CLI configuration:
gcloud config listThe gcloud CLI displays the list of properties similar to the following, where
ACCOUNT_EMAILandPROJECT_IDdisplay 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 createcommand:gcloud help compute instances createView available commands under
gcloud topic:gcloud help topicView information on filtering:
gcloud topic filtersLearn more about
gcloudcommand structure:gcloud topic command-conventions