If you are using Google Cloud Platform, installing Google Cloud SDK on your computer will be very useful. It's a collection of tools for managing your Google Cloud projects. It supports all services on the Cloud Platform such as Cloud Storage, Cloud Functions, Compute Engine, and other products. This tutorial is about how to install Google Cloud SDK on Linux, so that you can use it using gcloud
command
1. Make Sure Python v2.7 is Installed
First, make sure that you've Python v2.7 installed. Currently it doesn't work with Python v3.x
2. Download & Extract Google Cloud SDK
Download the archive of Google Cloud SDK. Open the link below
https://cloud.google.com/sdk/docs/quickstart-linux
On that page, choose the archive that best suited to your system, either the 64-bit or 32-bit. Then, unarchive the downloaded file.
3. Install Google Cloud SDK
After you download and extract the archive, you should see a file named install.sh
. Run the file using ./install.sh
command in order to install Google Cloud SDK on your system. If installation successful, you should be able to use gcloud
command after restarting your terminal.
4. Initialize Google Cloud SDK
Before using gcloud
command, run gcloud init
first. You'll be asked to login. A URL will be generated and it will automatically open your browser. Choose (and login to) the account you want to use for Cloud Platform. Then, click on Allow button - this will give Google Cloud SDK to manage the services on Cloud Platform. After that, you'll be asked whether you want to select an existing project or create a new project.
5. Using gcloud
command
Now you should be able to use gcloud
command and manage services using terminal. Below is the command format along with supported arguments and options.
gcloud GROUP | COMMAND [--account=ACCOUNT] [--configuration=CONFIGURATION]
[--flags-file=YAML_FILE] [--flatten=[KEY,...]] [--format=FORMAT]
[--help] [--project=PROJECT_ID] [--quiet, -q]
[--verbosity=VERBOSITY; default="warning"] [--version, -v] [-h]
[--log-http] [--trace-token=TRACE_TOKEN] [--no-user-output-enabled]
GLOBAL FLAGS
Flag | Description |
---|---|
--account=ACCOUNT |
Google Cloud Platform account. |
--configuration=CONFIGURATION |
The configuration to use. Run gcloud topic for more information. |
--flags-file=YAML_FILE |
A YAML or JSON file that specifies a --flag:value dictionary. |
--flatten=[KEY,...] |
Flatten name[] output resource slices in KEY into separate records for each item in each slice. |
--format=FORMAT |
The format for printing command output resources. Supported formats are: config, csv, default, diff, disable, flattened, get, json, list, multi, none, object, table, text, value, yaml. |
--help |
Display detailed help. |
--project=PROJECT_ID |
The Google Cloud Platform project name. |
--quiet, -q |
Disable all interactive prompts when running gcloud commands. |
--verbosity=VERBOSITY; default="warning" |
--verbosity=VERBOSITY; default="warning". Supported values are: debug, info, warning, error, critical, none. |
--version, -v |
Print version information and exit. |
-h |
Print a summary help and exit. |
OTHER FLAGS
Flag | Description |
---|---|
--log-http |
Log all HTTP server requests and responses to stderr. |
--region=REGION |
The Cloud region for the function. |
--trace-token=TRACE_TOKEN |
Token used to route traces of service requests for investigation of issues. |
--user-output-enabled |
Print user intended output to the console. |
GROUP
is one of the following:
Flag | Description |
---|---|
app |
Manage App Engine deployments. |
auth |
Manage Oauth2 credentials. |
bigtable |
Manage your Cloud Bigtable storage. |
builds |
Manage builds for Google Cloud Build. |
components |
Manage Cloud SDK components. |
composer |
Manage Cloud Composer Environments |
compute |
Manage Google Compute Engine resources. |
config |
Manage Cloud SDK properties. |
container |
Deploy and manage clusters of machines for running containers. |
dataflow |
Manage Cloud Dataflow jobs. |
dataproc |
Manage Cloud Dataproc clusters and jobs. |
datastore |
Manage your Cloud Datastore indexes. |
debug |
Manage Cloud Debugger. |
deployment-manager |
Manage deployments of cloud resources. |
dns |
Manage your Cloud DNS managed-zones and record-sets. |
domains |
Manage domains for your Google Cloud projects. |
endpoints |
Manage API services. |
firebase |
Manage Firebase. |
functions |
Manage Cloud Functions. |
iam |
Manage IAM service accounts and keys. |
iot |
Manage Cloud IoT resources. |
kms |
Manage cryptographic keys in the cloud. |
logging |
Manage Stackdriver Logging. |
ml |
Use Google Cloud ML capabilities. |
ml-engine |
Manage Cloud ML Engine jobs and models. |
organizations |
Manage Google Cloud Platform Organizations. |
projects |
Manage project access policies. |
pubsub |
Manage Cloud Pub/Sub topics and subscriptions. |
redis |
Manage Cloud Memorystore Redis resources. |
services |
Manage APIs and services. |
source |
Cloud git repository commands. |
spanner |
Command groups for Cloud Spanner. |
sql |
Manage Google Cloud SQL databases. |
topic |
gcloud supplementary help. |
COMMAND
is one of the following:
Flag | Description |
---|---|
docker |
(DEPRECATED) Enable Docker CLI access to Google Container Registry. |
feedback |
Provide feedback to Cloud SDK team. |
help |
Search gcloud help text. |
info |
Display current gcloud environment. |
init |
Initialize or reinitialize gcloud. |
version |
Print Cloud SDK components version information. |