From the course: Google Cloud Platform (GCP) Essential Training for Developers

Using the Google Cloud SDK - Google Cloud Tutorial

From the course: Google Cloud Platform (GCP) Essential Training for Developers

Start my 1-month free trial

Using the Google Cloud SDK

- [Instructor] Now we are going to learn how to use the Google Cloud SDK command line tools. This is what is primarily used for creating and managing resources in Google Cloud. This is also useful when you want to start creating your own scripts and automations. There are three main Google Cloud SDK CLI tools. First we have gsutil, which is for Google Cloud storage, then we have bq, which is for BigQuery, and finally gcloud, which is for the rest of Google Cloud. In this video, we will focus on gcloud. Let's go back to our terminal, and let's verify that we are logged in by typing gcloud auth list. As you can see, our email address has an asterisk to the left of it because it's active. We can have multiple authorized accounts, and we can switch between them as well. Now there are four main things to learn in gcloud, command groups, commands, configurations, and properties. A command group is like a menu with commands or more command groups inside it. To see the first level of command groups, let's go back to our terminal and type gcloud. Now we can see all the command groups available to us. Let's pick one, say ai-platform. First, let's press Q to close this list, and let's type gcloud ai-platform. Now we are shown the command groups available inside ai-platform, as well as the commands in this group. In this case, predict. We can also type --help to the end of any command or group to get more details in the context of that command or group. Let's try gcloud ai-platform --help. This gives us more details into what are the flags, groups, and commands available. Now let's talk about a special set of command groups called alpha and beta. The alpha and beta command groups contain commands that are still in alpha or beta. These commands may change in the future, and that's why they are separated. For example, let's compare the available commands for the ai-platform. Let's type gcloud ai-platform, and let's also try gcloud alpha ai-platform. As you can see, the alpha group has a new command group called locations that is not available yet in the general command. The alpha and beta command groups allow us to access these. Lastly, we can set and unset configuration properties. We do this with the command group gcloud config. Here we can see how we can set or unset the values of our configuration properties. We can see the properties that are currently configured by typing gcloud config list. These are the properties set in the current active configuration, which in this case is the configuration named default. A configuration is basically a set of defined properties. Let's check our configurations by typing gcloud config configurations list. We can have multiple configurations and switch between them. This is useful when you have different projects and different sets of properties, so you don't have to set and unset each property. You can just switch between configurations, and all the properties of that configuration are carried along with it. All right, gcloud is huge, but by using command groups, commands, and properties, and our very useful --help flag, it'll become really intuitive to navigate and manage GCB, even from the command line.

Contents