Skip to content
Related Articles

Related Articles

Google Cloud Platform – GCS Buckets
  • Last Updated : 03 Dec, 2020

In this article, we will look into Buckets and why they are the Cornerstone of Google Cloud Storage(GCS) in everything you do on GCS. Before you can do anything on Google Cloud Storage, you have to create a Bucket as anything you want to store in the GCS need to be stored inside a bucket in order to perform any operations on them.

While creating a Bucket there are three things that you need to specify:

  • A globally unique static Name
  • A Storage Class
  • An Access Policy

Let’s discuss them in detail.

Name:

 Naming is pretty straight forward.  The following are the Bucket naming Requirements:

  • All characters must be in lower case letters, numbers, and dashes(-), and Underscore(_).
  • Spaces are not allowed.
  • The name has to start and end with either a letter or number.
  • Bucket names can range from 3 to 63 characters, but names with dots in between them can range up to 222 characters. Although the maximum number of characters between two consecutive dots can only be 63.
  • String in IP Address form cannot be used as a bucket name (eg: 192.168.0.1).
  • The “goog” prefix cannot be used in the bucket name. Similarly, the “google” name cannot be used in the bucket name including close misspelling like “g00gle”.

Storage Class:

Google Cloud Storage has 4 different storage classes. All of them offer low latency and high durability, but they are varied based on their availability and minimum storage duration along with the pricing for storage and access. They are as follows:



  • Multi-Regional Storage Class: This is a high-performance object storage class that expands over the entire global presence of the GCS infrastructure. These are great for real-time access. It automatically duplicates your content across regions in a larger area. It is better suited for high redundancy applications.
  • Regional Storage Class: This is a high-performance object storage class that lives in a specific location inside the GCS infrastructure and is great when associated with usage in the surrounding areas.

  • Nearline Storage Class: This is a Backup & Archival storage class that stores content that is not frequently used like archival data, regulatory objects, or even disaster recovery data. The trade-off is straightforward too, you pay less to store the data but it also takes longer to fetch.
  • Coldline Storage Class: This storage class is similar to the Nearline storage class but with a slight variation.

Once you have chosen the storage class, you will need to choose where the data is stored. It should be done based on what type of redundancy you need, where your primary users are, and what you are expected the first time to bite is when caching is turned off.

After specifying the Name, Storage Class, and Location of your bucket, you want a sight into the Access Control Model you want for the Bucket meaning who and what has access to the stored contents.

Access Policy:

You can set the Access policy on the entire Bucket and all the contents in it or you can get more granular and set policies on an individual object or asset level. There is a lot that you can do with access policies and permissions but it is not the context of this article.

Methods for Bucket resources:

The following are the methods available for Bucket resources in GCS:

  • delete(): It deletes an empty bucket.
  • get(): this method returns the metadata of a specified bucket.
  • getIAMpolicy(): This method returns the IAM policy of a specified bucket.
  • insert(): this method is used to create a new bucket.
  • list(): It lists out all the buckets for a given project.
  • lockRetentionPolicy(): it is used to irreversibly sets the retention policy on a specified bucket.
  • patch(): this method is used to update the bucket.
  • setIAMpolicy(): This method is used to update the IAM policies of the bucket.
  • testIamPermissions(): This method is used for testing bucket access and permissions.
  • update(): As the name suggests, this method is used to update a bucket.
My Personal Notes arrow_drop_up
Recommended Articles
Page :