How to Create a Bucket in GCP

Create a Bucket & Upload Objects: GUI 


How to Create a Bucket in GCP



— Login to GCP Console: 

— Go to Cloud Storage 

— Bucket

— Create Bucket


  1. Name your bucket

     Labels (optional)


  1. Choose where to store your data

     Multi-region

     Dual-region

     Region


  1. Choose a default storage class for your data

— Standard 

— Nearline

— Coldline

— Archive


  1. Choose how to Control access to Object

— Uniform 

— Fine-grained 



  1. Choose how to protect object data Protection Tools    

— None

— Object Versioning 

— Retention policy



  1. Data Encryption:

— Google Managed Encryption Key 

— Customer Managed Encryption Key (CMEK)

— Create





Cloud Storage using Cloud shell:

— Open Cloudshell 

— Select your Projects


$ ls -l $HOME                                      

$ sudo rm -rf $HOME    — Restart Cloudshell 



  1. Create a Bucket

gcloud mb -b on -l us-east1 gs://gcp-buckets149/

gcloud 



  1. Upload an object into your Bucket:

— Cloudshell 

— Click on Tripple dot 

— File        

— Upload FIle


$ gsutil cp Raghav.png gs://gcp-buckets149 



  1. Download the object from your bucket: 

gsutil cp gs://gcp-buckets149/Raghav.png /home/gcpdec/download.png



  1. Copy the object to a folder in the bucket:

gsutil cp gs://gcp-bucket149/Raghav.png gs://gcp-bucket149/myfolder/New.png



  1. List Contents of a Bucket or Folders:

gsutil ls gs://gcp-bucket149



  1. List details for an object:

gsutil ls -l gs://gcp-bucket149/Raghav.png



  1. Make the Object Publicly Accessible:

gsutil iam ch allUsers:objectViewer gs://gcp-bucket149

gsutil iam ch -d allUsers:objectViewer gs://gcp-bucket149          (-d means not accessible in the internet, not to public)



  1. Delete an Object or Bucket:

gsutil rm gs://gcp-bucket149/Raghav.png



  1. Delete entire Bucket and it’s objects:

gsutil rm -r gs://gcp-bucket149




🙏 thanks


































Previous
Next Post »