Getting started with Google Cloud SDK

Hello, Peeps !

Recently I spoke about Google Cloud SDK in Google Cloud NEXT Extended event at Bangalore. I thought I should write an article about it to give you a fundamental understanding of Google Cloud SDK.

What ?

Google Cloud SDK is a set of tools for accessing Google public cloud platform in a secure way. It contains essential tools for maintaining, managing and monitoring Google Cloud Platform (GCP).

It is equivalent of Amazon Web Services CLI.

Why ?

Essentially many of the enterprises would automate monotonous mundane tasks to manage their infrastructure. Tools like these help in that process.

How ?


To start working with Cloud SDK, you need to install tools from here depending on your OS platform. One prerequisite is to have Python version 2.7.x or lesser

I recommend you to install the Python bundle coming along with the installer. Because the installer is not compatible with Python version 3.x and above, you can check about the same in Google Issue tracker.

Configuring your account

The first thing to do after successful installation is open your command line and type “gcloud” to check whether Cloud SDK has installed perfectly.

Run “gcloud init”, it opens up a new browser window and asks to login into your google cloud account. Come back to command line and select your options like the project, region/zone etc.

Tools and Commands

Cloud SDK comes along with a set of command tools

  1. gcloud : works with Google Compute Engine (equivalent of AWS EC2)
  2. bq : works with Cloud Bigquery (can be compared to Amazon Redshift)
  3. gsutil : works with Cloud Storage (equivalent of AWS S3/AWS EBS)

You can list/install/update these tools by using below command

gcloud components list

Output of after running above command

Scripting using gcloud commands

Use case: Spin up a VM in Cloud Compute engine and run a startup script to copy an image to a Cloud Storage Bucket.

Using gcloud and gsutil commands you can write a Python script. I tried one particular use case by following Google Cloud tutorial. I could not find the same tutorial and I uploaded the code used onto Github. will list the instance creates an instance Runs after the VM boots up

Cloud API Client Libraries

If you are a programmer and like working with some programming language, Google Cloud has given another way to use GCP.

Google Cloud comes with 7 Client API libraries. You can build a nice dashboard for your AWS and GCP cloud workloads.

There are exhaustive documentation and code samples for API Client Libraries in each language. Here is the link for Java Samples.

If none of the sample provided has the service implementation for a particular API, you can write your own implementation by using Google APIs

Security and Privacy Considerations

Last but not the least, Using Google Cloud SDK on your local machine might create some doubts to you in the security perspective.

gsutil ensures all the data transferred via TLS protocol to prevent any data leakage.

There are a ton of measures taken to ensure security while running these commands in your local/dev machine. However, in below article GCP explains would handle security risks.

If you are still not satisfied, without installing any command line tool, you can open a Cloud Dev Shell via GCP Console.

Available in top right corner in Google Cloud Console

I hope I gave a primer of the Cloud SDK. But if you still need more details then head over to this link OR drop a comment.

Thank you !