004 [Hands-on] Cloud Shell - 3

  • last month

Category

😹
Fun
Transcript
00:00Hello everyone and welcome back.
00:02So in this video, we are going to see one very important features related to cloud shell
00:08and we are going to explore those features as a demo in this video.
00:13Alright, so what I'm going to do, I am inside my cloud shell, cloud shell is still activated
00:20and we have created a two bucket.
00:23Now let's let me just make it a bigger screen because we are not going to deal with this
00:29web console, mostly we will be dealing with cloud shell and I thought that we should increase
00:36the font.
00:37Alright, so if I just do print working directory, it will be in a slash home slash GCP train
00:46in 2020.
00:47So currently I am inside this particular directory.
00:51Now as I told earlier, this cloud shell is a ephemeral virtual machine.
00:57Now ephemeral is a bit technical word.
00:58I would say that whenever you restart, nothing will persist.
01:04That's a very simple language that when you try to restart your machine, whatever you
01:10write apart from this particular working directory, everything will be lost.
01:17So what we are going to do, we know currently that inside the home slash GCP train in 2020
01:25folder, this four file exists.
01:27So just remember or what I'm going to do, let me make a snapshot.
01:32So that will be, there will be a snapping tool, yeah, that's good actually.
01:40So what I'm going to do, I'm just going to select this one, that inside this particular
01:46directory, and I'm just going to disable or I would say put it into another place.
01:53And let me go to some other place because this is like a full-fledged virtual machine.
01:58Let's just go to opt.
02:00So opt is the operating system level directory exists, where we have a container, Gradle,
02:06Maven, Microsoft, some folders exist.
02:08I'm going to create one file here.
02:11So let me just create, let's say, we will create with this nano-editor some hello.txt
02:21file.
02:22Let me press hello, hello123, I'm just going to write it, Ctrl-X and just save it.
02:30Yes, it is not able to save it, so I just have to come out because this is the operating
02:37system level directory, so I have to use like a shadow.
02:41As a root user, hello123, so very simple file, a text file we have created.
02:48And if you just do ls, you can see one file got created, hello.txt.
02:53So just remember that inside the opt, we have a hello.txt file exists.
03:00And inside this home gcp training, here also I can take a snapshot.
03:08So what I will do, let me open the word, word.
03:15And inside the word, you can put many snapshots.
03:20So there will be one snapshot which we have created.
03:24So let me just copy it and put it here.
03:27So you can see what I did.
03:29And let me create one more snapshot.
03:34Let me put it into another screen.
03:36I have multiple screens that are available, so just don't get confused where I am just
03:40lifting my, yeah.
03:42So from here, I'll just take this one.
03:45So before opt, we created this hello.txt, there is no file exists.
03:51But after that, we created one hello.txt file.
03:55And the same thing, I'm just going to put it.
03:58Alright, so let me just minimize everything, not required now.
04:04Next thing what I'm going to do, I'm going to restart this virtual or I won't say completely
04:09virtual machine.
04:10This is like a virtual machine only, but this is the cloud shell.
04:15So I can do the restart like this or I can just simply go to this three dot and there
04:21will be restart.
04:22Let me restart it.
04:24Now after that, once the machine got restarted, we'll go to both of this location and we will
04:30see what are the files still persist and what are the files not persist.
04:38Cloud shell is still provisioning because it is just restarting the complete machine.
04:48Still going on.
04:51I think it's a bit taking too much time.
04:53So what I'm going to do, let me restart it again or let me crash also, don't worry about
04:59it.
05:00Let's just wait.
05:01Yeah, so we are inside the cloud shell.
05:05You can see earlier we had a little more real estate and by default this project got selected.
05:11But currently again we have to do this ps1 is equal to $. Yes.
05:18So we got complete bigger real estate.
05:21Now what I'm going to do, what is my current working date?
05:23This one.
05:24If I just do ls, still all those files completely persist.
05:28You can have a comparison, exactly same thing, exactly same thing.
05:33So, no file, no folder got lost from this particular location because that is my current
05:39working home directory.
05:42Now next thing what we'll do, we'll go to this opt.
05:47And if I just try to do ls, now compared to earlier, you will be able to see we created
05:53this hello.txt, but now this hello.txt doesn't exist.
05:58That means that this is like an ephemeral virtual machine.
06:01Everything will persist only at one place in your current home working directory where
06:08everything will persist.
06:10So if you are, let's say, at some other location and if you want to go to current working directory,
06:16you can just simply use cd tilde and you can see we are inside our home directory.
06:24So that is the beautiful thing I want to show you.
06:27That this is the ephemeral virtual machine, your data will not persist apart from your
06:32home directory.
06:33Now, suppose if you want to install something, in that case, and you want to persist it for
06:40a couple of weeks, you can always do it inside your home directory rather than your op or
06:48any other.
06:49So, let's say, we will just go back and let's see what are the file exists.
06:57Let me just clear the screen and where we are.
07:01Yes, we are inside the home.
07:03Let me go one step back.
07:05Yes.
07:06So these are the files which do not persist apart from this home and your username.
07:13So currently your username, you can just search from here, uname linux.
07:17So whenever you want to install anything, put it inside the home folder and you want
07:21to persist it for a few weeks, you can always be able to get it from that location.
07:28Now, persisting means, earlier we have seen in the cloud shell documentation, they are
07:33providing 5 GB of persistent disk storage.
07:36So, up to 5 GB, you can always persist your data completely free of cost, 50 hours a week
07:43in this Google Cloud Platform.
07:45But where is this 50 or 5 GB?
07:48So, you can use the command like lsblk and you will be able to see, there will be a 5
07:57GB of storage inside this home folder they have given to us, 5g sdb1 inside the sdb.
08:06So, that means, this is like a 5 GB persistent storage apart from every single thing attached
08:12with our cloud shell virtual machines is ephemeral in nature that won't persist once
08:18your session got over or you restart your machine.
08:23Few more things about the Google Cloud Shell, let's say, how much memory and RAM they have
08:31given to us.
08:32So, if I just do free-m or I can do free-g, oops, it has to be double minus, or let me
08:43just clear the screen and let me fire the command again, free, yes, so we have a total
08:5016 GB of RAM they have provided with this particular machine.
08:55If you want to know about the CPU information, you can use like a lscpu and you will be able
09:01to see there will be a one, yeah, one core only, yeah, four core, four core machine they
09:07have provided.
09:08So, very high-end machine they have provided with this cloud shell.
09:11Alright, so these are the sufficient things to get started with your cloud shell environment.
09:18And mostly throughout this whole course, we are going to use this cloud shell environment
09:24to provision your resources and from the web console for the learning purpose.
09:28Alright, so that is all about the cloud shell.
09:31The next one will be a cloud SDK, but that will be from the local machine.
09:36So, somehow if Google Cloud web console application is down, you can always use your local machine
09:43to provision your resource.
09:44So, in the next video, we will see about those cloud shells specifically on a Windows machine.
09:49I'll show you how to install it and how to authenticate with your cloud shell environment,
09:56resources to provision different resources directly from your local machine.
10:01Alright, see you in the next video.