006 [Hands-on] Cloud SDK Part - II

  • last month

Category

😹
Fun
Transcript
00:00All right, everyone, so the next thing, let's just get continue and get ourselves familiar
00:10with the Google Cloud SDK.
00:13So I'm going to go to my command line prompt and let me just make fonts little bigger.
00:22It will be at 28, oops, is not applicable, yes, now it's bigger and clearly visible.
00:34So first thing is our Google Cloud SDK knows that through which account and we are going
00:42to interact with the different services.
00:44So we have already one account which is active state of Google Cloud Platform account.
00:52So the first command which we are going to fire is AuthList.
00:58So that will be a Gcloud AuthList.
01:01And you can see there is no credential with this Google Cloud SDK has been attached.
01:08So they are saying one suggestion that to log in, you can just simply use Google AuthLogin.
01:15Now how this commands and utility will come.
01:17So let me just give you a little brief idea that when you type gcloud-help, you will be
01:25able to see that what are the options are available.
01:29These are the options.
01:31I guess you can just simply type Gcloud and there will be available command groups for
01:38the Gcloud.
01:40Now here there will be one like Auth.
01:44You will be able to see Auth, yes, this is like Auth.
01:50So all those authentication related API can be called Gcloud Auth.
01:55Now after Auth, what you need to write, let's say you don't know.
01:59So you can just simply type Gcloud Auth and it will give you another list of suggestions
02:06that what are the other options you can put it.
02:10Like Activate Service Account, Configure Docker, List, Login.
02:14So one of the commands which we use Auth List.
02:18But there is no credential associated.
02:20So we are going to continue with first of all, authenticate our Google Cloud SDK with
02:27our GCP account.
02:29So that will be a Google Auth List instead of now Google Auth Login.
02:36Let me press Enter and it will open inside my browser.
02:41Suppose if it doesn't open inside the browser, you can just simply select this particular
02:46URL, copy it manually and paste it inside the browser.
02:51From here you can authenticate with different users.
02:55Currently this gcptrainin2020 at gmail.com is my current active account on a Google Cloud.
03:05So they are asking some kind of permission that Google Cloud SDK wants to access your
03:10Google account, this one.
03:13And we are going to allow it.
03:15The moment you allow and authentication is successful, you will be redirected to you
03:21are now authenticated with Google Cloud SDK.
03:25If you just go, let me just minimize it and if you just press Enter, you will be able
03:33to see that you are now logged in as this particular user.
03:37Your current project is this.
03:39So this is the default project it has taken and you can change the setting by this command
03:45if you want to change the project setting.
03:47Now few more commands or before that, let me run the same command like gcloud auth list
03:58and you can see now earlier we don't have any credentials are associated.
04:03Now we have one active account gcptrainin2020 at gmail.com.
04:08If you want to change this account or revoke some access, exactly same thing you can do
04:13it gcloud auth and we have one options are available like a revoke.
04:20So it will revoke all those authenticated account.
04:24If you want to list earlier also we have seen.
04:26So all those account got authenticated and which one is active.
04:31So based on star, you will be able to see which one is the active account.
04:35Let's say if you want to authenticate one more account.
04:39So auth login and I have one more account.
04:45So let's say my own email id.
04:49Alright and let me just allow it.
04:53So currently with this another email id also I am authenticated to use everything from
04:59Google Cloud SDK.
05:02So now you are logged in as this another gmail id.
05:06If you just type now gcloud auth list, so you will be able to see now my current active
05:13account is this one.
05:15But to set another active account, you can use this command gcloud config set.
05:21So you can see Google Cloud SDK is smart enough that based on the kind of command you fire,
05:27it will give you a suggestion that what other things you should do.
05:31So what I'm gonna do gcloud config set account.
05:35Let me paste it and along with that I'm gonna select this particular email id.
05:43Yes, property got updated.
05:48If you just try to do it again, gcloud auth list compared to our earlier case, we have
05:54now gcptraining2020 at gmail.com has to be our active account, but there is no star listed.
06:04Why such a thing happens?
06:05So what we can do, we can again do auth login and we can authenticate our gcptraining2020
06:14allow and successfully authenticated.
06:19So let me just minimize it.
06:20And now if you do auth list, you will be able to see now my current active account
06:26is gcptraining2020 at gmail.com.
06:29And if you want to revoke all those access, just simply type revoke-all.
06:36Something like that.
06:37So all those accounts will be kind of sign out from here.
06:42So this is one of the very important utility gcloud auth that how you are going to authenticate
06:49your cloud SDK with your GCP resources.
06:53Alright.
06:54So that is about the gcloud auth.
06:57There will be few more things like a gcloud config.
07:02So all those default configuration parameter has been set inside this config.
07:07I'm not putting any more option apart from gcloud config.
07:13So it will give me suggestion that what you can do.
07:15You can set some key value pair.
07:17You can unset something.
07:19So let's just list that as of now, what are the parameter has been set.
07:25So you can see the important one will be account.
07:28So account is currently set to gcptraining2020 at gmail.com.
07:33And along with that, I have projects like project centralmuse300814.
07:39That is nothing but my first project.
07:42Let me just go back again and I want to show you, let's say console that how that numbers
07:51or project ID came.
07:55So if you just logged in into your web console of Google Cloud Platform in your my first
08:03project, that is just the name, but we have ID like centralmuse300815 and Google has automatically
08:09created those things for us.
08:11And that is nothing but this one.
08:14Now suppose if you want to set some property, now currently there is one two more property
08:18also got set, which I haven't discussed, a region and a zone.
08:22So whenever you provision anything, if you do not provide those zones and region by default,
08:28this SDK will take care from here, this config list.
08:32Later on, we'll see how you can even unset some of the properties also, and you can again
08:37set it also.
08:38So whenever we require, there are lots of options are possible.
08:42So wherever when we try to provision more and more resources, wherever we require, we
08:46try to use those commands.
08:48Now exactly the same sets of commands will work from your cloud shell.
08:53Also currently we are hacking all those commands directly from our local machine.
08:59Let me just type gsutil.
09:01Alright, so gsutil also installed.
09:05So what we will do, creating bucket and uploading one file to those particular bucket, we will
09:12see in the next video.
09:14But now not from a cloud shell, we are going to use cloud SDK from our local machine of
09:19Windows.
09:21See you in the next video.