Cloud Storage allows world-wide storage and retrieval of any amount of data at any time. You can use Cloud Storage for a range of scenarios including serving website content, storing data for archival and disaster recovery, or distributing large data objects to users via direct download.
Create a storage bucket
Upload objects to the bucket
Create folders and subfolders in the bucket
Make objects in a storage bucket publicly accessible
I needed to click on the Google Cloud Shell from the top right of the Google Cloud Console.
Cloud Shell
Manage your infrastructure and develop your applications from any browser with Cloud Shell.
Cloud Shell comes with Cloud SDK gcloud, Cloud Code, an online Code Editor and other utilities pre-installed, fully authenticated and up-to-date. Learn more.
Cloud Shell is free for all users.
Gemini Code Assist is enabled in Cloud Shell Editor by default for all users.
Authorize Cloud Shell
Cloud Shell needs permission to use your credentials to make Google Cloud API calls.
Click Authorize to grant permission to this and future calls.
STEP: List the gcloud
student_01_2cab0553971a@cloudshell:~ (qwiklabs-gcp-01-b6b0a57c3e87)$ gcloud auth list
Credentialed Accounts
ACTIVE: *
ACCOUNT: student-01-2cab0553971a@qwiklabs.net
To set the active account, run:
$ gcloud config set account `ACCOUNT`
student_01_2cab0553971a@cloudshell:~ (qwiklabs-gcp-01-b6b0a57c3e87)$
Create a bucket
In this lab you use gcloud storage commands.
When you create a bucket you must follow the universal bucket naming rules, below.
Bucket naming rules
Do not include sensitive information in the bucket name, because the bucket namespace is global and publicly visible.
Bucket names must contain only lowercase letters, numbers, dashes (-), underscores (_), and dots (.). Names containing dots require verification.
Bucket names must start and end with a number or letter.
Bucket names must contain 3 to 63 characters. Names containing dots can contain up to 222 characters, but each dot-separated component can be no longer than 63 characters.
Bucket names cannot be represented as an IP address in dotted-decimal notation (for example, 192.168.5.4).
Bucket names cannot begin with the "goog" prefix.
Bucket names cannot contain "google" or close misspellings of "google".
Also, for DNS compliance and future compatibility, you should not use underscores (_) or have a period adjacent to another period or dash. For example, ".." or "-." or ".-" are not valid in DNS names.
Use the make bucket (buckets create) command to make a bucket, replacing <YOUR_BUCKET_NAME> with a unique name that follows the bucket naming rules:
gcloud storage buckets create gs://photobucket_rr
gcloud storage cp ada.jpg gs://photobucket_rr
gcloud storage cp -r gs://photobucket_rr/ada.jpg .
gcloud storage cp gs://photobucket_rr/ada.jpg gs://photobucket_rr/image-folder/
gcloud storage ls gs://photobucket_rr
gcloud storage ls -l gs://photobucket_rr/ada.jpg
gcloud storage objects update gs://photobucket_rr/ada.jpg --add-acl-grant=entity=allUsers,role=READER
gcloud storage objects update gs://photobucket_rr/ada.jpg --remove-acl-grant=allUsers
gcloud storage rm gs://photobucket_rr/ada.jpg
No comments:
Post a Comment