The Google Cloud CLI
1. The Google Cloud CLI
Next, we look at the Google Cloud CLI. The Google Cloud Command Line Interface, or gcloud CLI, provides tools to manage Google Cloud services from the command line or in automated scripts. These tools provide the functionality of the Cloud APIs in an easy-to-use command-line interface. They automate the process of sending credentials in the Cloud API calls and combine multiple Cloud API calls when required to complete a single common task. You can use the gcloud CLI to perform most tasks allowed by the Cloud APIs. For example, you can manage virtual machines or deploy applications to run on Google Cloud. The gcloud CLI includes many command-line tools. For example, gcloud interacts with Google Cloud services, gsutil manages Cloud Storage buckets and objects, and bq runs queries and manages data in BigQuery. Other command-line tools can be used to manage Kubernetes, emulate Google Cloud services like Firestore or Pub/Sub, or create infrastructure by using Terraform. The gcloud CLI tool lets you perform most common tasks on Google Cloud, including creating and managing resources for many services. This example command, gcloud compute instances list, shows the Compute Engine virtual machine instances for your project. The gcloud CLI tool also lets you manage the Google Cloud CLI tools. The command "gcloud components list" describes each of the CLI components. Each component is listed as not installed, update available, or installed at the latest version. To install a component at the current CLI version, use the "gcloud components install" command. For example, to install the Kubernetes cluster manager kubectl, you'd run the command "gcloud components install kubectl." You can update your version of the Google Cloud CLI with the command "gcloud components update." Next, we discuss the gcloud, gsutil, and bq CLI tools. Cloud Storage provides reliable, secure, and highly performant object storage. The gsutil command can be used to create and manage buckets and objects. gcloud storage is now the preferred command line tool for managing Cloud Storage. gcloud storage performs better than gsutil, and its usage is similar to other gcloud commands. gcloud storage buckets creates, lists, deletes, and manages access control lists for buckets. gcloud storage objects manages objects and their access control lists. gcloud storage commands can be used to copy, move, list, and delete objects. This gcloud storage command example copies a file from your local machine into a Cloud Storage bucket. bq is a command-line tool for BigQuery, Google Cloud's serverless, highly scalable, and cost-effective data warehouse. bq can be used to manage datasets, tables, and other BigQuery entities, but its primary purpose is running queries. This example query searches for all occurrences of a word in a sample public dataset that contains the complete word index of Shakespeare's works.2. Let's practice!
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.