Google Cloud SDK Tutorial: What It Is, 7 Powerful Uses, Easy Setup and Real-Time Examples

For my first year on Google Cloud, I did everything by clicking. Create a bucket: click. Upload a file: click. Load it into BigQuery: click, click, click. One Monday my manager asked me to load 40 CSV files from the weekend into BigQuery before 10 AM. I sat there clicking the same buttons again and again, and I knew something was wrong. A senior colleague watched for two minutes, opened a terminal, typed three lines and finished the whole job before my tea got cold. That was the day I learned about the Google Cloud SDK.

In this tutorial I will explain the Google Cloud SDK in simple words: what it is, what tools are inside it, what it is used for, how to install and set it up step by step on Windows, Linux and macOS, when you should use it (and when the console is fine), and three real-time examples you can copy and run today.

What Is Google Cloud SDK?

The Google Cloud SDK is a free set of command-line tools from Google that lets you create, manage and automate everything on Google Cloud Platform (GCP) from your own computer’s terminal, instead of clicking in the web console.

SDK stands for Software Development Kit. A “kit” means it’s not one tool but a small toolbox. The most important tool inside it is gcloud, so many people simply call the whole thing “gcloud”.

Simple definition: Google Cloud SDK is a toolbox you install on your laptop or server that lets you control Google Cloud with typed commands, so you can do in seconds, and repeat automatically, what takes many clicks in the console.

Google Cloud SDK vs Google Cloud CLI: same thing?

Yes, almost. Google now officially calls it the Google Cloud CLI (Command Line Interface). The old name “Google Cloud SDK” is still everywhere: the install folder is still called google-cloud-sdk, the Homebrew package is google-cloud-sdk, and most tutorials and job descriptions still use it. When you read “Cloud SDK”, “gcloud CLI” or “Google Cloud CLI”, they all mean this same toolbox.

Don’t confuse it with the Cloud Client Libraries (for example google-cloud-bigquery for Python or Java). Those are libraries you use inside your application code. The Google Cloud SDK is what you use from the terminal and in scripts.

A simple real-life comparison

The Cloud Console is like ordering food at a restaurant counter: you look at the menu and point at what you want. Fine for one order. The Google Cloud SDK is like a standing order with your tiffin service: you write down exactly what you want once, and it arrives every day without you doing anything. When the work repeats, typed commands win.

What Is Inside the Google Cloud SDK?

The Google Cloud SDK is made of components. Some come by default and others you can add when needed.

Tool / ComponentWhat it doesExample
gcloudThe main tool. Manages almost every GCP service: projects, IAM, VMs, Cloud Run, Cloud SQL, storage and more.gcloud run deploy
gcloud storageUpload, download, copy and sync files in Cloud Storage buckets. The newer, faster replacement for gsutil.gcloud storage cp file.csv gs://my-bucket/
gsutilThe older Cloud Storage tool. Still works, but Google recommends gcloud storage for new work.gsutil ls gs://my-bucket
bqWorks with BigQuery: create datasets, load data, run queries, export tables.bq query 'SELECT 1'
EmulatorsRun Firestore, Pub/Sub, Bigtable, Spanner and Datastore locally for free testing.gcloud emulators firestore start
Extra componentskubectl, alpha/beta commands, Cloud SQL Proxy, App Engine extensions and more.gcloud components install kubectl

How Google Cloud SDK Works

Every Google Cloud service has a REST API behind it. Even when you click a button in the console, the console is just calling that API for you. The Google Cloud SDK calls the same APIs, but from your terminal. Here is what happens when you type a command:

  1. You run a command, for example gcloud storage buckets list.
  2. The SDK reads your configuration: which Google account, which project and which default region to use.
  3. It attaches your credentials, the login token you created with gcloud auth login (or a service account key).
  4. It calls the Google Cloud API over HTTPS.
  5. Google checks IAM permissions. If your account is allowed, the action happens; if not, you get a “permission denied” error.
  6. The result comes back to your terminal as a table, JSON or YAML.
Your Terminal  ──►  Google Cloud SDK  ──►  Google Cloud APIs  ──►  IAM check  ──►  Your resources
 (gcloud / bq)     (config + login)         (HTTPS REST)          (allowed?)        (VM, bucket, BigQuery)

Since IAM decides what you can do, it helps to understand our guides on Google Cloud IAM and Service Accounts.

7 Uses of Google Cloud SDK

These are the seven ways I use the Google Cloud SDK most in real projects:

  1. Automating repeated tasks: daily file uploads, nightly BigQuery loads, weekly backups, all in a simple script.
  2. Deploying applications: one command deploys code to Cloud Run, Cloud Functions or App Engine.
  3. Data engineering: moving CSV/JSON files into Cloud Storage and loading them into BigQuery with gcloud storage and bq.
  4. Creating infrastructure quickly: VMs, buckets, Cloud SQL instances, Pub/Sub topics and firewall rules in seconds.
  5. CI/CD pipelines: GitHub Actions, GitLab CI, Jenkins and Cloud Build all use gcloud commands to build and deploy.
  6. Managing access and security: giving roles, creating service accounts and checking who has access to what.
  7. Local development and testing: running Firestore or Pub/Sub emulators on your laptop, and letting your code use your own login through Application Default Credentials.

When to Use Google Cloud SDK (and When Not To)

✅ Use Google Cloud SDK when:

  • You do the same task again and again (daily, weekly, for many files or many projects).
  • You want to automate something with a shell script, cron job or CI/CD pipeline.
  • You need to work with many resources at once, like copying 500 files or listing all VMs in 10 projects.
  • You want a record of exactly what you did. A command can be saved, shared and reviewed; a click cannot.
  • A feature is only available in the CLI or in alpha/beta commands, which happens often with new features.
  • You are developing locally and your code needs to talk to GCP using your login.

❌ The console or another tool is better when:

  • You are exploring a service for the first time and want to see all options visually.
  • You need charts and dashboards: billing reports, monitoring graphs, logs explorer.
  • It’s a one-time, small task you’ll never repeat.
  • You manage large, long-lived infrastructure for a team. Use Terraform (Infrastructure as Code) for that, and keep gcloud for scripts and quick work.
  • You can’t install anything on your computer. Use Cloud Shell instead (it has the SDK already installed in the browser).

Google Cloud SDK vs Console vs Cloud Shell vs Client Libraries

OptionWhere it runsBest for
Cloud ConsoleWeb browserLearning, exploring, dashboards, one-off tasks
Google Cloud SDKYour laptop, server or CI machineAutomation, scripts, deployments, bulk work
Cloud ShellBrowser (free small VM with SDK pre-installed)Quick commands without installing anything
Client LibrariesInside your app code (Python, Java, Node.js, Go)Applications that call GCP while running
TerraformYour machine or CIManaging full infrastructure as code for teams

How to Install and Set Up Google Cloud SDK

Before you start: you need a Google account and a Google Cloud project (new accounts get free trial credits). The Google Cloud SDK needs Python 3, but don’t worry: the Windows installer and the Linux x86_64 package come with their own bundled Python, so most people don’t need to install Python separately.

Option 1: Install Google Cloud SDK on Windows

  1. Open the official Google Cloud CLI install page and download the Google Cloud CLI installer for Windows (works on Windows 8.1 and later).
  2. Double-click GoogleCloudSDKInstaller.exe and follow the steps. Keep “Install Bundled Python” ticked.
  3. On the last screen, keep “Run gcloud init” ticked and click Finish. A command window opens.

Or do it from PowerShell in one go:

(New-Object Net.WebClient).DownloadFile("https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe", "$env:Temp\GoogleCloudSDKInstaller.exe")
& $env:Temp\GoogleCloudSDKInstaller.exe

Option 2: Install Google Cloud SDK on Linux or macOS (quick script)

curl https://sdk.cloud.google.com | bash

# Restart your shell so the PATH changes take effect
exec -l $SHELL

Answer Y when it asks to update your PATH and enable command completion.

Option 3: Install on Ubuntu / Debian with apt (best for servers)

sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates gnupg curl

curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg

echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list

sudo apt-get update && sudo apt-get install -y google-cloud-cli

The advantage of apt: sudo apt-get upgrade keeps the Google Cloud SDK updated along with the rest of your server.

Option 4: Install on macOS with Homebrew

brew install --cask google-cloud-sdk

Step 2: Check the installation

gcloud version

You should see the Google Cloud SDK version along with bq, core and gcloud-crc32c. If you get “command not found”, close and reopen your terminal.

Step 3: Initialize with gcloud init

gcloud init

This one command walks you through three things:

  1. Login: a browser opens; sign in with your Google account and click Allow.
  2. Pick a project: choose your project from the list (or create a new one).
  3. Default region/zone: for India, choose asia-south1 (Mumbai) or asia-south2 (Delhi).

Step 4: Set up login for your code (Application Default Credentials)

gcloud auth login is for the gcloud commands themselves. If your Python, Java or Node.js code running on your laptop also needs to call GCP, run this once:

gcloud auth application-default login

Now client libraries pick up your login automatically. No key files needed on your laptop.

Step 5: Check and change your settings

# See current account, project and region
gcloud config list

# Change the default project
gcloud config set project my-project-id

# Change the default region
gcloud config set compute/region asia-south1

# See all logged-in accounts
gcloud auth list

Step 6 (pro tip): Use configurations for dev and prod

If you work on more than one project, configurations save you from running a command in the wrong project, which is a very common and painful mistake.

gcloud config configurations create dev
gcloud config set project my-app-dev
gcloud config set compute/region asia-south1

gcloud config configurations create prod
gcloud config set project my-app-prod
gcloud config set compute/region asia-south1

# Switch any time
gcloud config configurations activate dev
gcloud config configurations list

Step 7: Install extra components and keep the SDK updated

gcloud components list
gcloud components install kubectl beta
gcloud components update

Note: if you installed with apt or Homebrew, update through apt or brew instead, because gcloud components is disabled for package-manager installs.

Most Useful Google Cloud SDK Commands

Keep this table handy. These are the Google Cloud SDK commands I use almost every day:

TaskCommand
List projectsgcloud projects list
Enable an APIgcloud services enable run.googleapis.com
Create a bucketgcloud storage buckets create gs://my-bucket --location=asia-south1
Upload filesgcloud storage cp *.csv gs://my-bucket/raw/
Sync a foldergcloud storage rsync ./reports gs://my-bucket/reports --recursive
Run a BigQuery querybq query --use_legacy_sql=false 'SELECT ...'
List VMsgcloud compute instances list
SSH into a VMgcloud compute ssh my-vm --zone=asia-south1-a
Deploy to Cloud Rungcloud run deploy my-api --source=. --region=asia-south1
Read logsgcloud logging read "severity>=ERROR" --limit=20
Get help for any commandgcloud run deploy --help

Tip: add --format=json or --format="table(name,status)" to any gcloud command to control the output. This is very useful in scripts.

Real-Time Examples of Google Cloud SDK

Example 1: Daily sales CSV from shops into BigQuery (data engineering)

Business scenario: A chain of 25 kirana stores in Pune exports a sales CSV from each billing machine every night. The owner wants all sales in BigQuery by 7 AM for a morning dashboard. Doing this by hand means 25 uploads and 25 loads every day. With the Google Cloud SDK, it’s one script.

Billing PCs ──► /data/sales/*.csv ──► gcloud storage cp ──► Cloud Storage ──► bq load ──► BigQuery ──► Dashboard

One-time setup:

gcloud storage buckets create gs://kirana-sales-raw --location=asia-south1

bq mk --dataset --location=asia-south1 my-project:kirana_sales

bq mk --table kirana_sales.daily_sales \
  store_id:STRING,bill_no:STRING,product:STRING,qty:INT64,amount:NUMERIC,sale_date:DATE

load_sales.sh, the daily script:

#!/bin/bash
set -e

DAY=$(date -d "yesterday" +%Y-%m-%d)
BUCKET="gs://kirana-sales-raw/$DAY"

echo "Uploading sales files for $DAY..."
gcloud storage cp /data/sales/*.csv "$BUCKET/"

echo "Loading into BigQuery..."
bq load \
  --source_format=CSV \
  --skip_leading_rows=1 \
  kirana_sales.daily_sales \
  "$BUCKET/*.csv"

echo "Quick check:"
bq query --use_legacy_sql=false \
  "SELECT store_id, SUM(amount) AS total
   FROM kirana_sales.daily_sales
   WHERE sale_date = '$DAY'
   GROUP BY store_id
   ORDER BY total DESC"

# Move processed files so they are not loaded twice
mkdir -p /data/sales/done/$DAY
mv /data/sales/*.csv /data/sales/done/$DAY/
echo "Done."

Schedule it at 6 AM every day with cron:

chmod +x load_sales.sh
crontab -e

# add this line
0 6 * * * /home/ubuntu/load_sales.sh >> /home/ubuntu/load_sales.log 2>&1

That’s it. Every morning the owner opens the dashboard and yesterday’s sales are already there. If the data needs cleaning first, you can add a step with Dataflow or Dataform later.

Example 2: Deploy an API to Cloud Run in one command (app developer)

Scenario: You built a small Python Flask API for your Android app and want it live on the internet with HTTPS. No server setup, no Docker knowledge needed.

# Enable the required APIs once
gcloud services enable run.googleapis.com cloudbuild.googleapis.com artifactregistry.googleapis.com

# From your project folder (with main.py and requirements.txt)
gcloud run deploy quotes-api \
  --source=. \
  --region=asia-south1 \
  --allow-unauthenticated

# Get the live URL
gcloud run services describe quotes-api --region=asia-south1 --format="value(status.url)"

The Google Cloud SDK uploads your code, Cloud Build turns it into a container, and Cloud Run gives you a URL like https://quotes-api-xxxxx-el.a.run.app. Change the code and run the same command again to release a new version. Read our full Cloud Run tutorial for more.

Example 3: Automatic deployment from GitHub with a service account (CI/CD)

Scenario: Your team wants every push to the main branch to deploy automatically. The CI machine has no human to log in through a browser, so we use a service account.

# 1. Create a service account for deployments
gcloud iam service-accounts create github-deployer \
  --display-name="GitHub Deployer"

# 2. Give it only the roles it needs
gcloud projects add-iam-policy-binding my-project \
  --member="serviceAccount:github-deployer@my-project.iam.gserviceaccount.com" \
  --role="roles/run.admin"

gcloud projects add-iam-policy-binding my-project \
  --member="serviceAccount:github-deployer@my-project.iam.gserviceaccount.com" \
  --role="roles/iam.serviceAccountUser"

.github/workflows/deploy.yml

name: Deploy to Cloud Run
on:
  push:
    branches: [ main ]

jobs:
  deploy:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      id-token: write
    steps:
      - uses: actions/checkout@v4

      - uses: google-github-actions/auth@v2
        with:
          workload_identity_provider: ${{ secrets.WIF_PROVIDER }}
          service_account: github-deployer@my-project.iam.gserviceaccount.com

      - uses: google-github-actions/setup-gcloud@v2

      - run: |
          gcloud run deploy quotes-api \
            --source=. \
            --region=asia-south1 \
            --quiet

Here the setup-gcloud step installs the Google Cloud SDK on the GitHub machine, and the same gcloud run deploy command you use on your laptop runs automatically. Workload Identity Federation lets GitHub log in without storing any JSON key. That’s the safest way.

Google Cloud SDK Pricing

The Google Cloud SDK itself is 100% free to download and use. You only pay for the Google Cloud resources you create with it, such as VMs, storage, BigQuery queries or Cloud Run requests. Those cost exactly the same whether you create them with a click or a command.

Cloud Shell, which comes with the SDK pre-installed, is also free to use within its weekly usage limit.

Advantages and Disadvantages

AdvantagesDisadvantages
Free to useLearning curve if you have never used a terminal
Very fast for repeated and bulk tasksA wrong command can delete things quickly, with no “are you sure” screen in scripts
Perfect for automation, scripts and CI/CDNot visual: no graphs or dashboards
Works on Windows, Linux and macOSMany flags to remember (but --help helps)
New features often arrive in the CLI firstNeeds regular updates to get new commands
Commands can be saved, shared and reviewedLarge setups are easier to manage with Terraform

Best Practices and Common Mistakes

Best practices for Google Cloud SDK

  • Always run gcloud config list before doing anything risky, to confirm the project.
  • Use configurations to separate dev and prod.
  • Use your own login on your laptop and service accounts only for machines and pipelines.
  • Prefer Workload Identity Federation or attached service accounts over downloaded JSON keys.
  • Give service accounts the smallest role they need, never Owner.
  • Use gcloud storage instead of gsutil for new scripts. It’s faster.
  • Add set -e to shell scripts so they stop at the first error.
  • Run gcloud components update (or apt/brew upgrade) every few weeks.

Common mistakes I have seen

  • Running a delete command in the wrong project because the default project was never changed.
  • Committing a service account JSON key to GitHub. Bots find these within minutes.
  • Confusing gcloud auth login with gcloud auth application-default login, then wondering why Python code says “credentials not found”.
  • Forgetting to enable the API first (gcloud services enable ...) and getting confusing errors.
  • Using --quiet in scripts with delete commands without testing the script first.

Interview Questions on Google Cloud SDK

  1. What is Google Cloud SDK? A free set of command-line tools (gcloud, gcloud storage/gsutil, bq) to manage and automate Google Cloud resources.
  2. What does gcloud init do? It logs you in, sets the default project and optionally the default region/zone.
  3. gcloud auth login vs gcloud auth application-default login? The first gives credentials to gcloud commands; the second creates Application Default Credentials for your code and client libraries.
  4. gsutil vs gcloud storage? Both manage Cloud Storage; gcloud storage is newer, faster and recommended.
  5. How do you manage multiple projects? With gcloud config configurations, or the --project flag on each command.
  6. How does a CI/CD pipeline authenticate? With a service account, ideally through Workload Identity Federation instead of a JSON key.
  7. What is Cloud Shell? A free browser-based terminal with the Google Cloud SDK pre-installed and already logged in.

Frequently Asked Questions

Is Google Cloud SDK free?

Yes. The Google Cloud SDK is completely free. You only pay for the cloud resources you create and use.

Do I need to install Python for Google Cloud SDK?

Usually not. The Windows installer and the Linux x86_64 package include a bundled Python. On macOS and some Linux setups it uses a supported Python 3 already on your system.

What is the difference between Google Cloud SDK and Cloud Shell?

The Google Cloud SDK is installed on your own computer. Cloud Shell is a small free machine in your browser that already has the SDK installed. Use Cloud Shell for quick work and the local SDK for daily development and automation.

How do I uninstall Google Cloud SDK?

On Windows, uninstall “Google Cloud SDK” from Apps & features. On Linux/macOS (script install), delete the google-cloud-sdk folder and the ~/.config/gcloud folder, and remove the PATH lines from your shell profile. For apt, run sudo apt-get remove google-cloud-cli.

How do I switch between Google accounts in gcloud?

Log in with each account using gcloud auth login, see them with gcloud auth list, and switch with gcloud config set account you@example.com.

Conclusion

The Google Cloud SDK is the toolbox that turns Google Cloud from a website you click into a platform you can control and automate. Install it once, run gcloud init, and you can create buckets, load BigQuery tables, deploy Cloud Run apps and build full CI/CD pipelines with a few lines of text. Use the console to explore and learn; use the Google Cloud SDK for anything you’ll do more than twice.

My advice: install it today, run the kirana sales example with two or three sample CSV files, and watch them appear in BigQuery. Once you see that, you’ll never go back to clicking 40 times on a Monday morning. For the full command list, the official gcloud reference is your best friend.

Leave a Comment