What is Cloud Storage Bucket?
Google Cloud Storage is an object-based service that allows you to store objects in any file format. An Object can be any individual file or folder whereas a bucket is referred to as a container or object-based drive or a root folder where you store your objects.
Cloud Storage can be used as a staging area also. For example, if any of your applications need to access the data from somewhere like Cloud SQL, BigQuery, or Dataproc, you can place the data in a cloud storage bucket.
There are many ways for accessing your objects and Buckets.
- The first and easiest way of accessing Cloud Storage is using GCP Console.
- Another way can be using Command-Line or SDK. Before opting, you have to install the SDK in the system.
- You can also access it using RESTful APIs ot HTTP URL.
You can choose to create different location types in which :
- Multi-regional is where you would store files for use by your applications which are worldwide.
- Dual-region is best when your file needs to be accessed in associated regions.
- Regional is best for any internal jobs that require storage.
There are multiple storage classes which you can choose while creating a bucket mentioned below:
- Standard Storage is used for data which is regularly accessed or stored only for a short period of time.
- The nearline is for backups where you have a minimum storage duration of 30 days.
- Coldline is for disaster recovery, basically data you will not be accessing but needs to be stored for when regulatory authorities ask for it, where you have a minimum storage duration of 90 days.
- Archive is for data archival, you can say the coldest service where the minimum duration is 365 days.
Accessing data from Standard buckets is free. Fetching from the Nearline costs some money, and fetching from the Coldline costs even more, and lastly fetching from the archival storage costs even more.
- This lab walks you through GCP Cloud Storage Bucket.
- You will be creating a Cloud Storage Bucket.
- You will upload an Object in the bucket.
- Login into GCP Console.
- Creating a Bucket.
- Uploading an Object.
- Giving permissions to the bucket.
Creating a Cloud Storage Bucket:
- Click on the hamburger icon on the top left corner
- Click on the Cloud Storage > Browser
3. Click on create bucket.
4. Enter the name for your bucket as my-storage-lab21. Click Continue.
5. Choose the location as US and type as multi-region to get high availability. Click Continue.
6. Choose storage class as Standard. Click Continue.
7. Choose access control as Uniform to get the same access for all the objects in the bucket. Click Continue.
8. Leave everything Default. Click on create to finally create your bucket
9. Choose upload files in your bucket as shown
10. Once you choose your file and upload it, it will appear like this. Object names can be different.
11. You have to add permission so that only authenticated users can see the object.
12. Now select Permissions Tab. Click on add.
13. Enter member as allAuthenticatedUsers and Select choose role as Storage object viewer in Cloud Storage.
14. Click on Save to continue.
15. Click on allow public access.
16. You can see your uploaded object.
17. You can use this public URL to load your object.
Completion and Conclusion:
In this lab, you have created a Cloud Storage Bucket and uploaded an Object into the bucket.