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.
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.
Essentially many of the enterprises would automate monotonous mundane tasks to manage their infrastructure. Tools like these help in that process.
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.
The first thing to do after successful installation is open your command line and type
gcloud to check whether Cloud SDK has installed perfectly.
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.
Cloud SDK comes along with a set of command tools
You can list/install/update these tools by using below command
gcloud components list
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.
list-instance.py: will list the instance
create-instance.py: creates an instance
startup-script.sh: Runs after the VM boots up
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
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 this 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.
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 !