This page shows how to install the Google Cloud SDK, initialize it, and run
gcloud commands from the command-line.
Before you begin
Create a Google Cloud Platform project, if you don't have one already.
Make sure that Python 2.7 is installed on your system:
Download the archive file best suited to your operating system. Most machines will run the 64-bit package. If you'd like to check, run
uname -mto verify if you're running a 64-bit system.
Platform Package Size SHA256 Checksum Linux 64-bit
google-cloud-sdk-272.0.0-linux-x86_64.tar.gz 30.1 MB 1920b14a985e12e8658607685aec9abed8f8dde499d773bc1ca6f0abe1b25425 Linux 32-bit
google-cloud-sdk-272.0.0-linux-x86.tar.gz 29.7 MB 5b78262ba7e44531ab48b354f4771cc5813d978e564b5a7fecb278d31cf75148
Alternatively, to download the Linux 64-bit archive file from your command-line, run:
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-272.0.0-linux-x86_64.tar.gz
For the 32-bit archive file, run:
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-272.0.0-linux-x86.tar.gz
Extract the archive to any location on your file system; preferably, your Home folder. On Linux, you can extract the archive file by running this command:
tar zxvf [ARCHIVE_FILE] google-cloud-sdk
Optional:Use the install script to add Cloud SDK tools to your path. You will also be able to opt-in to command-completion for your
bashshell and usage statistics collection during the installation process. Run the script using this command:
Restart your terminal for the changes to take effect.
Alternatively, you can call Cloud SDK after extracting the downloaded archive by invoking its executables via the full path.
Initialize the SDK
gcloud init command to perform several common SDK setup tasks. These
include authorizing the SDK tools to access Google Cloud Platform using your
user account credentials and setting up the default SDK configuration.
To initialize the SDK:
Run the following at a command prompt:
Note: If you get an error related to the gcloud command not being found, refer to step 5 in the section above.
Note: To prevent the command from launching a web browser, use
gcloud init --console-onlyinstead. To authorize without a web browser and non-interactively, create a service account with the appropriate scopes using the Google Cloud Platform Console and use
gcloud auth activate-service-accountwith the corresponding JSON key file.
Accept the option to log in using your Google user account:
To continue, you must log in. Would you like to log in (Y/n)? Y
In your browser, log in to your Google user account when prompted and click Allow to grant permission to access Google Cloud Platform resources.
At the command prompt, select a Cloud Platform project from the list of those where you have Owner, Editor or Viewer permissions:
Pick cloud project to use:  [my-project-1]  [my-project-2] ... Please enter your numeric choice:
If you only have one project,
gcloud initselects it for you.
If you have the Google Compute Engine API enabled,
gcloud initallows you 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:
gcloud initconfirms that you have complete the setup steps successfully:
gcloud has now been configured! You can use [gcloud config] to change more gcloud settings. Your active configuration is: [default]
Run core gcloud commands
gcloud commands to view information about your SDK installation:
To list accounts whose credentials are stored on the local system:
gcloud auth list
gclouddisplays a list of credentialed accounts:
Credentialed Accounts ACTIVE ACCOUNT * firstname.lastname@example.org email@example.com
To list the properties in your active SDK configuration:
gcloud config list
gclouddisplays the list of properties:
[core] account = firstname.lastname@example.org disable_usage_reporting = False project = example-project
To view information about your Cloud SDK installation and the active SDK configuration:
gclouddisplays a summary of information about your Cloud SDK installation. This includes information about your system, the installed SDK components, the active user account and current project, and the properties in the active SDK configuration.
To view information about
gcloudcommands and other topics from the command line:
For example, to view the help for
gcloud compute instances create:
gcloud help compute instances create
gclouddisplays a help topic that contains a description of the command, a list of command flags and arguments, and examples of how to use it.
- Read the
gcloudtool guide for an overview of the
gcloudcommand-line tool, including a quick introduction to key concepts, command conventions, and helpful tips.
- Read the
gcloudreference guide for detailed pages on each
gcloudcommand, including descriptions, flags, and examples, that you can use to perform a variety of tasks on Google Cloud Platform.
- Install additional components such as the App Engine emulators or
kubectlusing the Cloud SDK component manager.