How to Use the gcloud Utility - dummies

How to Use the gcloud Utility

By Matthew Scarpino

After you install the Software Development Kit (SDK), you can execute gcloud commands on a command line. All gcloud commands have the same format:

gcloud [optional flags] <group | command>

For example, you can check the version of gcloud by entering the following:

gcloud version

This command identifies the SDK’s version and the versions of its components. You can install the latest components by entering the following command:

gcloud components update

In this example, components is a group name because it requires additional commands, such as update. You can think of a group like a submenu in a graphical user interface. In contrast, version is a command name because it doesn’t accept further commands.

If you enter gcloud help, you see a long list of gcloud‘s groups and commands. gcloud’s groups make it possible to manage web applications, access databases, and configure DNS settings. This table lists ten of these groups.

gcloud Groups

Group Operation
app Manage App Engine deployments
auth Manage oauth2 credentials
components Install, update, and remove SDK components
compute Access resources related to the Compute Engine
config View and edit SDK configuration
domains Manage domains associated with the project
ml Access machine learning capabilities
ml-engine Manage machine learning jobs and models
projects Create and manage project access
services List, enable, and disable APIs and services

The ml-engine group plays a central role because it lets you upload and execute TensorFlow applications in the cloud. The figure displays many, but not all, of the groups and commands associated with ml-engine.

tensorflow-gcloud
Commands in the Cloud SDK have many levels and options.

To deploy and run an application in the cloud, you need to be familiar with the commands in the jobs subgroup of gcloud ml-engine. To the ML Engine, a job refers to a processing task, which could be training or prediction. For example, the following command tells the engine that you want it to launch a training job:

gcloud ml-engine jobs submit training

To tell the GCP where to find your code, you need to follow the command with configuration flags. Three flags are particularly important:

  • --package-path: The local directory containing the training source code
  • --module-name: The name of the package’s main module
  • --staging-bucket: The Cloud Storage bucket where the package and its dependencies should be stored