Google Certified Associate Cloud Engineer 2020

Sign Up Free or Log In to participate!

Storage Location and Storage Classes + Cloud Shell Exercises

Folks,

There is a slight difference from what we can see on the lecture and what we can see on GCP Console right now. On the video, you see Mattias speaking and explaining about the location of the data, where that storage area will be allocated for you to create your buckets, together with the storage classes, at that time, only Nearline and Coldline were available.

You will see that the screen is horizontally sliced when you see the "Choose where to store your data" which refers to the location of the data or "a permanent choice which defines the geographic placement of your data and affects cost, performance, and availability" and the "Choose a default storage class for your data" which defines the way your data will be stored and further accessed when you need, as that, "a storage class sets costs for storage, retrieval, and operations. Pick a default storage class based on how long you plan to store your data and how often it will be accessed".

On the screen you can see a definition for the location of data, or, if the bucket is Regional, Dual-region, or even Multi-regional, and what is your choice for the storage class, being them Standard, Nearline, Coldline and Archive.

pimballeke@cloudshell:~$ gcloud projects list  
PROJECT_ID                      NAME                      PROJECT_NUMBER  
gke-new-project                 gke-new-project           878756970870  
service-exploration-labs-20430  Service Exploration Labs  925052827016  
pimballeke@cloudshell:~$ gcloud config set project service-exploration-labs-20430  
Updated property [core/project]. #: it can delay a little bit when you first use it  

pimballeke@cloudshell:~ (service-exploration-labs-20430)$ gsutil mb -b off -c archive -l us-central1 gs://mybucket998877665501  
Creating gs://mybucket998877665501/...  

pimballeke@cloudshell:~ (service-exploration-labs-20430)$ gsutil cp README-cloudshell.txt gs://mybucket998877665501  
Copying file://README-cloudshell.txt [Content-Type=text/plain]...  
- [1 files][  913.0 B/  913.0 B]  
Operation completed over 1 objects/913.0 B.  

pimballeke@cloudshell:~ (service-exploration-labs-20430)$ gsutil ls gs://mybucket998877665501  
gs://mybucket998877665501/README-cloudshell.txt  

pimballeke@cloudshell:~ (service-exploration-labs-20430)$ gsutil rm gs://mybucket998877665501/README-cloudshell.txt  
Removing gs://mybucket998877665501/README-cloudshell.txt...  
/ [1 objects]  
Operation completed over 1 objects.

pimballeke@cloudshell:~ (service-exploration-labs-20430)$ gsutil rm -r gs://mybucket998877665501  
Removing gs://mybucket998877665501/...

#: Additionals

https://cloud.google.com/storage/docs/gsutil/commands/mb

https://cloud.google.com/storage/docs/locations

https://cloud.google.com/storage/docs/gsutil/commands/rm

I hope it helps, folks; any comments are very welcome!

-Bianchi

Ahmed Reda

Hello Bianchi and Cloud Guru’s, Sorry to bug you with this but I am having a minor issue and cannot find a solution online. After making sure im in the right Project ID whenever I try to rm a file I get a new line starting with ">". Then I noticed I was deleting a pdf file, I added a text file then I was able to delete it. My question is why can’t I delete a pdf file through cloudShell? or what is the best way to do so?

2 Answers

Hello Ahmed,

I’m not sure I understood correctly your question. But, is it related to upload and remove a *.pdf file?

wagnerbianchijr@cloudshell:~ (acloudguruproject)$ gsutil ls  
wagnerbianchijr@cloudshell:~ (acloudguruproject)$ gsutil mb gs://mytestbucket-1029834718092  
Creating gs://mytestbucket-1029834718092/...

Using the console, I uploaded a *.pdf file and checked again.

wagnerbianchijr@cloudshell:~ (acloudguruproject)$ gsutil ls gs://mytestbucket-1029834718092/**  
gs://mytestbucket-1029834718092/Ze0uno4rI=.pdf    
wagnerbianchijr@cloudshell:~ (acloudguruproject)$ gsutil rm gs://mytestbucket-1029834718092/Ze0uno4rI=.pdf      
Removing gs://mytestbucket-1029834718092/Ze0uno4rI=.pdf...  
/ [1 objects]  
Operation completed over 1 objects.    
wagnerbianchijr@cloudshell:~ (acloudguruproject)$ gsutil ls gs://mytestbucket-1029834718092/**  
CommandException: One or more URLs matched no objects.  
wagnerbianchijr@cloudshell:~ (acloudguruproject)$ gsutil rb gs://mytestbucket-1029834718092  
Removing gs://mytestbucket-1029834718092/...  
wagnerbianchijr@cloudshell:~ (acloudguruproject)$ gsutil ls  
wagnerbianchijr@cloudshell:~ (acloudguruproject)$

Did I understand it correctly? Can you share the history of commands you were running on your Cloud Shell instance?

-Bianchi

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?