• 4 months ago

Category

😹
Fun
Transcript
00:00Alright everyone, so let's just continue our discussion on Google Cloud Shell.
00:09We have seen many of the features it can provide to us directly inside the browser.
00:14Let's see a few more things about the Google Cloud Shell.
00:18So, what I'm gonna do, let me press clear and we'll have a little more real estate.
00:25Now I want to focus upon one utility like a G Cloud.
00:30Now if I just write G Cloud, G Cloud is by default installed.
00:35You can see with respect to AI and machine learning, API and platform, you can just press
00:40enter and you will be able to see all those things like a compute related, data analytics
00:46related, database.
00:48So every single services you can interact, you can modify, you can update, you can provision
00:54your resource directly from this G Cloud utility.
00:59Now as a demo, in this video, what we are gonna see, we have already created one bucket.
01:08So this is the bucket.
01:09I can just directly go to storage from here.
01:14I can just directly go to storage from here or I can just go from this hamburger menu
01:21and from here we have a storage and browser.
01:24Now make sure that when you have already opened this particular cloud shell, you do not refresh
01:33your page.
01:34The moment you refresh your page, that means new session of cloud shell terminal will open.
01:40So we have one bucket which we have created directly from this cloud web console.
01:46Now we are going to create exactly the same thing but from the command line utility.
01:51That is nothing but from your cloud shell.
01:54Now we are inside the cloud shell.
01:56Now to create a new bucket, there will be one utility available like a Gsutil.
02:02This particular G Cloud has lots of lots of functionality.
02:06I am not going into detail because it is something like it doesn't make sense at this moment.
02:12But as we progress, as we learn about more and more service, most of the times we are
02:17going to use this cloud shell.
02:19So Gsutil, a Google storage utility.
02:23So from this particular utility, you can create your bucket.
02:28Now most important thing about this particular utility G Cloud, Gsutil, same way for other
02:36services like BigQuery, we have a BQ, then for Kubernetes, we have Kubeflow, and there
02:42are many more things available.
02:45If you don't get anything that how to write the command, just simply type "-help".
02:51And immediately you, so Gsutil is requesting your credential to make a GCP API call.
02:58Because indirectly whatever Gsutil has been installed inside your cloud shell that wants
03:04to authorize an authentication to create something on this Google storage.
03:12Alright, so these are the things you can do it.
03:17So something like a cat command we have, we have a hashing, we have CP for copying files,
03:25we have a MB.
03:27So that is for the make bucket.
03:29So we are not going into detail about different options.
03:33But at this shot, what I'm going to do, I'm just going to use Gsutil MB.
03:43Now after MB, I don't know what are the options I need to write.
03:47I can just simply use Gsutil make bucket help.
03:51I don't know what to do next.
03:54So there are a hell lot of options are available that where you want to provision your resources
04:00and what is the location type, we have a storage class, but we haven't learned about anything.
04:05So in a simple term, what I'm going to do, let me just write Gsutil MB and just provide
04:16your bucket name with all those default parameters, it will create a brand new bucket for us.
04:22So exactly on the same line, I'm going to write name bk- instead of web console, now
04:28I'm going to use this cloud shell because we are creating from the cloud shell.
04:33Let me just press enter.
04:38And you can see command exception that MB command doesn't support this kind of file
04:44you are in.
04:45So purposely I just written it because the moment you are trying to access any kind of
04:51file in your local system, it has to be generally start with this one.
04:56And when you do not provide anything, the Google assume that you are trying to access
05:01file, colon, double slash.
05:04But that is not the protocol on which this Google Cloud Storage works.
05:09So they are expecting you to write this one.
05:13So instead of writing name this way, the Google Cloud Storage, every single file has to be
05:20accessed with this way, Gs, Google Storage.
05:25Let me just press enter.
05:27And you can see creating this particular bucket.
05:31Now don't try to refresh it, otherwise the new session of Google Cloud Shell will be
05:36open.
05:37So what I would suggest you to just refresh and you will be able to see we got created
05:43our new bucket bk-cloudshell.
05:48Now earlier in the last video in a web console, if you just go, we uploaded one file like
05:55a cat1.jpg.
05:56Same way, through command line utility, this gsutil, we want to put one file cat1.jpg or
06:05any other file.
06:06What are the files available?
06:07Yes, we have same cat1.jpg is available here.
06:11Now you can understand that why I uploaded this cat1.jpg here.
06:15I can upload some other files also.
06:17So let me just provide cat2.jpg.
06:23So on a bottom right, you can see with this green tick indicates that successfully transferred.
06:28So let me just close in and let's type ls.
06:33So ls will give you the information that what are the current files and folders are available
06:38in current working directory.
06:40So we have a cat2.jpg also.
06:42Now I want to transfer this cat2.jpg to this particular bucket.
06:47So what I am going to do, gsutil, simple.
06:53Then we saw one option associated with this one like a copy.
06:57So you are going to copy this cat2.jpg from your local machine.
07:07Now in this case, the local machine will be your cloud shell.
07:10For you, everything will be in a cloud, but you are accessing this cat2.jpg from the same
07:16machine.
07:17So I am just writing here cat2.jpg, no particular protocol or anything.
07:22By default, it will take care like this one, file.
07:28So this is where it is trying to access it.
07:31So from this particular location, cat2.jpg, I am going to transfer it to this gs-bk-cloud-shell.
07:40So I just select it.
07:41That means it got copied.
07:43Press Ctrl-V. So simple.
07:46Let me just press Enter.
07:49And you can see it's just started copying file.
07:52So by default, it has a prefix this file colon double slash.
07:57And transferred it to this particular bucket location.
08:02Now if you want to see what are the contents are available inside this bk-cloud-shell.
08:09And you can see cat2.jpg file got uploaded.
08:15If you just click upon it, you will be able to see the complete URL.
08:21Now there is few more things I want to highlight at this level.
08:25What we are gonna do, let me just copy this complete URL.
08:30And earlier also I showed that this is the image.
08:35Now let me open the notepad.
08:38And I want to show you this particular URL.
08:42And focus upon this URL.
08:44Now when we created first time this bucket, there is one thing we need to take care that
08:55it has to be globally unique.
08:57Now you can see this particular part storage.cloud.google.com will always remain same whenever you are
09:04trying to access any of the resources through HTTP protocol over the internet or whatever
09:10objects are available to access any objects are available in this storage bucket.
09:16But this storage bucket if it is unique, how can two URLs should exist for the one single
09:23thing.
09:24Or maybe for two different things the same URL exists.
09:28So, if it is not unique, it is not going to work.
09:31It is something like for google.com there will be two websites exist.
09:36Or for apple.com there will be two websites exist.
09:39So, that's why this is the logical reason behind that the cloud bucket name has to be
09:46globally unique.
09:47Now, this particular bucket name nobody can take throughout this world.
09:51Even if you change any single character inside that, that will be a completely different
09:55bucket name.
09:56So, that is the reason behind your bucket name has to be globally unique.
10:01Otherwise, your URL will not be unique.
10:04Alright.
10:05Let me just close it.
10:08One more tips I want to share with you that whenever you try to learn any of the service
10:13and there is some URL associated, try to grab more and more information directly from the
10:19URL.
10:20Now, this storage.cloud that means you are trying to access a storage related stuff.
10:27Don't save it.
10:28Alright.
10:29So, from the command line also, we have used the two commands.
10:34First one will be make buckets.
10:36You can practice yourself and there will be one more like a gsutil.
10:40Now, you can see there is no authorization authentication happens.
10:46All calls are completely authorized and authentication.
10:49But when we try to access the very first time this gsutil, it has automatically asked for
10:54our permission to call for this API directly inside the storage bucket.
11:01Alright.
11:02So, that is all about the cloud shell.
11:06In the next video, there is one more important thing, although I haven't discussed in much
11:11more detail.
11:12So, I would think that that's a very important thing and I'm going to discuss in the next
11:17video related to cloud shell.
11:20See you in the next video.

Recommended