What is the need of SDK:
Cloud SDK provides language-specific Cloud Client Libraries supporting each language’s natural conventions and styles. This makes it easier for you to interact with Google Cloud APIs in your language of choice. Client libraries also handle authentication, reduce the amount of necessary boilerplate code, and provide helper functions for pagination of large datasets and asynchronous handling of long-running operations.
It is also advisable to insytal the Google Cloud Command Line Interface:
The gcloud CLI manages authentication, local configuration, developer workflow, and general interactions with Google Cloud resources. With the Google Cloud CLI, it’s easy to perform many common cloud tasks like creating a Compute Engine VM instance, managing a Google Kubernetes Engine cluster, and deploying an App Engine application, either from the command line or in scripts and other automation.
Installing the SDK:
After you get comfortable with the Google Cloud Console, you’ll want to install the Google Cloud SDK. The SDK is a suite of tools for building software that uses Google Cloud, as well as tools for managing your production resources. In general, anything you can do using the Cloud Console can be done with the Cloud SD and gcloudCLi.
Google Cloud SDK is readily available for the following programming Language with Reference Links below:
Google Cloud SDK for Java: https://cloud.google.com/java/docs/reference
Google Cloud SDK for Go : https://cloud.google.com/go/docs/reference
Google Cloud SDK for Python : https://cloud.google.com/python/docs/reference
Google Cloud SDK for Ruby : https://cloud.google.com/ruby/docs/reference
Google Cloud SDK for PHP : https://cloud.google.com/php/docs/reference
Google Cloud SDK for C# : https://cloud.google.com/dotnet/docs/reference
Google Cloud SDK for C++ : https://github.com/googleapis/google-cloud-cpp
Note : The Google Cloud SDK is free for most common prigramming laguages. However there may be some additonla price for select components.
The Google SDK can be installed using teh link : https://cloud.google.com/sdk/docs/install-sdk
It starts with installing the Google Cloud CLI. Please follow the instructions to install the Google Cloud CLI based upon teh OS of your local machine.
For example for a Debian/ Ubuntu Linux machine the steps are as follows:
Ensure that https transport is enabled:
sudo apt-get install apt-transport-https ca-certificates gnupg
If your Debian distribution supposrt signed-by option:
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
echo “deb https://packages.cloud.google.com/apt cloud-sdk main” | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
Import The Google Cloud public key.
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key –keyring /usr/share/keyrings/cloud.google.gpg add –
Update and install the gcloud CLI:
sudo apt-get update && sudo apt-get install google-cloud-cli
Update and install the gcloud CLI:
sudo apt-get update && sudo apt-get install google-cloud-sdk
You can also install a host of other additonal components. These can be found here : https://cloud.google.com/sdk/docs/components#additional_components
Base don your distribution these can either be installed through apt or with yum.
For example, the google-cloud-cli-app-engine-java component can be installed as follows:
sudo apt-get install google-cloud-cli-app-engine-java
Feel free to install anything that looks interesting to you—you can always add or remove components later on. For each exercise that we go through, we always start by reminding you that you may need to install extra components of the Cloud SDK. You also may be occasionally prompted to upgrade components as they become available.
For example, here’s what you’ll see when it’s time to upgrade:
Updates are available for some Cloud SDK components. To install
them, please run:
gcloud components update
Now you can initiliase your gcloud:
This command can perform several common gCloud CLI setup tasks. These inlcude authorozong the gCloud CLI to access Google Cloud using your user account credentials and setting up the default configuration.
You will be prompted to login using your Google user account.
To continue, you must log in. Would you like to log in (Y/n)? Y
You will also be required to select the Google projects already created in the account. Please select the project using its numeric tag.
If you have OCmpute Engine API enables, gloud init will also allwo you to choose a default Compute Engine Zone or not.
Once this is completed gcloud init confirms that the setup is successfull completed.
Core Command sets:
Core commnas can be run to view the gCloud CLI installation.
List accounts whose credentials are stored in the local system:
gcloud auth list
Lits the properties in your active gloud CLI configuration:
gcloud cofig List
View information about your gCloud CLI installation and active configuration :
For information about gcloud commands and other topics:
View help on gloud compute instances create:
gcloud help compute instances create