Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

While the GCP Console is great for interacting with GCP through a graphical interface, the gcloud CLI (Command Line Interface) is the primary tool for automating tasks and managing resources from your terminal.

In a nutshell, it allows you to interact with GCP services through text commands instead of clicking through the web interface. The gcloud CLI is also part of the Google Cloud SDK.

Why Use the CLI?

When To Use the CLI?

Where to Use It?

  1. Cloud Shell: The gcloud tool is pre-installed and authenticated in the browser-based Cloud Shell terminal we explored in the previous chapter. No installation required.

  2. Local Machine: You can install the Google Cloud SDK on your own laptop (Windows, macOS, or Linux) to manage your cloud projects without opening a browser.

Key Capabilities

Anatomy of a gcloud Command

Most commands follow a simple structure:

gcloud [GROUP] [SUBGROUP] [ACTION] [NAME] --[FLAGS]

Example in Action

If you want to create a virtual machine, the command looks like this:

PartCommand FragmentPurpose
GroupcomputeWe are working with the compute engine service
SubgroupinstancesSpecifically, we want a virtual machine
ActioncreateWe want to create a new virtual machine instance
Nameaims-vmThis is the name we are giving the instance
Flag--zone=us-central1-aThis tells GCP what zone to create the instance

The full command is:

gcloud compute instances create aims-vm --zone=us-central1-a

🔑 Key Takeaways

🚀 What’s Next?

We are moving into the practical hands-on phase of the GCP foundations part. In the next two chapters, you will complete structured hands-on tutorials:

Hands-on Tutorial 1: Using the Console

Hands-on Tutorial 2: Using the gcloud CLI


📚 References & Further Reading