Google Cloud Platform (GCP) is a set of cloud computing services offered by Google. GCP is a public platform that offers IT resources, such as storage, compute, database, Big Data, application development tools, networking, and more. The GCP services run on the same cloud infrastructure that Google internally uses to run its end-user products, such as Google Photos, Gmail, Google Search, Google Drive, YouTube, etc. Software engineers, IT professionals, and cloud administrators can access the services provided by Google Cloud Platform over a dedicated network connection or the Internet.
Cloud SDK ((Software Development Kit) is a set of tools that users can use to manage applications and resources hosted on the Google Cloud Platform. These tools include the gsutil, gcloud, and bq command-line tools. The gcloud command-line tool gets automatically downloaded along with the Google Cloud SDK installation. Google Cloud SDK can run on Linux, Windows, macOS and requires Python 2.7.x. In this tutorial, we will learn about the steps to install and initialize Google Cloud SDK on a Windows instance.
Install the Latest Cloud SDK Version (352.0.0)
To install the latest Cloud SDK version on the Google Cloud’s Windows instance, follow the below steps:
1. First, download the Cloud SDK installer by clicking here. Alternatively, go to the command prompt and type powershell to open the PowerShell terminal. After that, execute the following commands in that terminal to download the Cloud SDK installer.
(New-Object Net.WebClient).DownloadFile("https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe", "$env:Temp\GoogleCloudSDKInstaller.exe") & $env:Temp\GoogleCloudSDKInstaller.exe
2. After the download, launch the Cloud SDK installer and follow the prompts. Google LLC will sign the installer. For a more streamlined screen reader experience, select the Turn on screen reader mode option if the user wants to enable screen reader mode.
3. Cloud SDK requires Python to work smoothly. The supported versions are Python 2 (2.7.9 or higher) and Python 3 ( the installer comes with Python 3 bundled by default; preferred, 3.5 to 3.8). The user operating system must run one of these supported Python versions for Cloud SDK to run properly. The Cloud SDK installer installs all necessary dependencies, including the needed Python version. By default, Google Cloud SDK will currently install and manage Python 3. Users can uncheck the Install Bundled Python option if they don’t want to install a new Python installation or to use an existing Python installation.
4. The Cloud SDK installer presents several options after completing the installation.
Ensure that the following options are selected:
- Start Google Cloud SDK Shell
- Run gcloud init
The Cloud SDK installer will start a terminal window and run the gcloud init command.
5. The default installation does not provide the App Engine extensions that are required to deploy an application using the gcloud commands. Users can install these App Engine extensions using the Cloud SDK component manager.
- If the Cloud SDK installer installation is unsuccessful due to the find command not being recognized issue, make sure that the user’s PATH environment variable is set to include the folder containing find. Usually, this is C:\WINDOWS\system32.
- If the user has just uninstalled Cloud SDK, they will need to reboot the system before installing it again.
Install the Latest Google Cloud Client Libraries (Optional)
Users can download the Cloud Client Libraries for supported languages from the following URL:
Initialize Cloud SDK
Users can use the gcloud init command to perform several everyday Cloud SDK setup tasks. These include setting up the default configuration and authorizing the Cloud SDK tools to access Google Cloud using the user account credentials. To initialize the Cloud SDK, follow the below steps:
1. First, execute the following command at the command prompt:
>>Note: Users can execute the gcloud init –console-only command instead to prevent the command from launching a web browser. To authorize without a web browser and non-interactively, create a service account with the appropriate scopes using the Google Cloud Console and execute the gcloud auth activate-service-account command with the corresponding JSON key file.
2. Then, accept the option to log in using the Google user account:
To continue, you must log in. Would you like to log in (Y/n)? Y
3. In the web browser, log in to the user’s Google user account when prompted and click Allow to grant permission to access its resources.
4. At the command prompt, select a Google Cloud project from the list of those where the users have Owner, Viewer, or Editor permissions:
Pick cloud project to use:  [my-project-1]  [my-project-2] ... Please enter your numeric choice:
5. If the users only have one project, the gcloud init command will select it for the user. If the users have access to more than 200 projects, the system will prompt the user to enter a project id, list projects, or create a new project.
This account has a lot of projects! Listing them all can take a while.  Enter a project ID  Create a new project  List projects Please enter your numeric choice:
6. If the user has the Google Compute Engine API enabled, the gcloud init command will allow the users to choose a default Compute Engine zone:
Which compute zone would you like to use as project default?  [asia-east1-a]  [asia-east1-b] ...  Do not use default zone Please enter your numeric choice:
The gcloud init command will confirm that we have completed the setup steps successfully, as shown below:
gcloud has now been configured! You can use [gcloud config] to change more gcloud settings. Your active configuration is: [default]
7. This step is optional. If the user wants a more streamlined screen reader experience, the gcloud command-line tool has an accessibility/screen_reader property. To enable this property, execute the following:
gcloud config set accessibility/screen_reader true
This tutorial presents the steps to install and initialize Google Cloud SDK on a Windows instance. Hope this tutorial was helpful, and do reach out to us if you have any queries or suggestions.