Getting Started with gcloud CLI - A Beginner’s Guide

Learn how to install, configure, and use the gcloud CLI to manage Google Cloud resources directly from your terminal.

Hafeez BaigHafeez BaigSep 28, 20252 min read

Introduction

When working with Google Cloud, the gcloud CLI is one of the most powerful tools at your disposal. Instead of navigating the Cloud Console UI, you can manage resources, configure services, and automate tasks, all from your terminal.

Whether you’re a beginner exploring Google Cloud for the first time or a developer looking to speed up your workflow, the gcloud CLI offers a consistent and scriptable way to interact with your projects. In this guide, we’ll cover installation, setup, and the basic commands you need to get started.


1. What is gcloud CLI?

The gcloud CLI is Google Cloud’s official command-line interface. It lets you interact with almost every Google Cloud service including Compute Engine, Kubernetes Engine, Cloud Storage, and BigQuery.

With gcloud, you can:

  • Spin up and manage VM instances
  • Deploy applications
  • Configure networking
  • Manage IAM roles and permissions
  • Automate workflows with scripts

Think of it as your Swiss Army knife for Google Cloud.


2. Installing gcloud CLI

On macOS or Linux

bash
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-darwin-arm.tar.gz tar -xf google-cloud-cli-darwin-arm.tar.gz ./google-cloud-sdk/install.sh

Or simply use Homebrew (macOS):

bash
brew install --cask gcloud-cli

On Windows

Download the installer from Google Cloud SDK and follow the wizard.

After installation, verify with:

bash
gcloud --version

3. Setting Up Your First Project

Run the init command:

bash
gcloud init

This will:

  1. Authenticate with your Google account.
  2. Select or create a project.
  3. Set up default configurations (region/zone).

To check active project:

bash
gcloud config list

4. Commonly Used gcloud Commands

Here are some essentials you’ll use often:

🚀 Managing Compute Engine

bash
# List VM instances gcloud compute instances list # Create a VM gcloud compute instances create my-vm --zone=us-central1-a

📦 Working with Cloud Storage

bash
# List buckets gcloud storage buckets list # Upload a file gcloud storage cp file.txt gs://my-bucket/

🔑 Managing IAM

bash
# Add a role to a user gcloud projects add-iam-policy-binding PROJECT_ID \ --member="user:example@gmail.com" \ --role="roles/viewer"

5. Configurations & Profiles

If you work with multiple projects:

bash
gcloud config configurations create dev gcloud config configurations create prod

Switch between them easily:

bash
gcloud config configurations activate prod

6. Automating with gcloud

Since it’s CLI-based, you can script your workflows:

bash
#!/bin/bash # Deploy VM + storage bucket gcloud compute instances create demo-vm --zone=us-east1-b gcloud storage buckets create gs://demo-bucket

Add this to CI/CD pipelines for repeatable deployments.


7. Tips for Beginners

  • Use --help to explore commands:

    bash
    gcloud compute --help
  • Always check your active project to avoid creating resources in the wrong one.

  • Use tab completion for faster command discovery.


Conclusion

The gcloud CLI may feel intimidating at first, but once you get the hang of it, you’ll wonder how you ever managed Google Cloud without it. It’s faster, more scriptable, and perfect for automating repetitive tasks.

Start small. List VMs, create a storage bucket, and gradually move into scripting and multi-project management. The more you practice, the more natural it will feel.


Liked this post? Stay tuned for my upcoming deep-dive on automating Google Cloud deployments with gcloud and Terraform!

Subscribe to my newsletter

Coming soon.

||