Cloud Service >> Knowledgebase >> Storage >> How To Create a Google Cloud Storage Bucket?
submit query

Cut Hosting Costs! Submit Query Today!

How To Create a Google Cloud Storage Bucket?

Another Google Cloud service that you can use if your application needs to store and access a lots of unstructured data, videos, images, MP3 files or data backups is Google Cloud Storage. The information is stored in entities, combining the files and corresponding data. Every item is linked to a distinct key that allows for data retrieval. Buckets are utilized for arranging and handling items, with each bucket connected to a different name. Data can be stored in various Google Cloud Storage locations by creating buckets, allowing redundancy and quicker access.

 

Key Features of Google Cloud Storage Buckets

 

- Versioning: Enabling versioning for a bucket lets you simultaneously store several versions of an object in the bucket. This is beneficial for situations like data retrieval and auditing.

- Public Access refers to a scenario where anyone using the internet can access the data. At the same time, the reverse is the case for private Access, as data access is limited to only a few people.

- Lifecycle Management: It is possible to set rules that allow objects to be transferred to other storage classes or deleted automatically after a specific time.

- Data Management: Google Cloud Storage API is the interface by which you gain programmatic control to work with your data on Google Cloud Storage. Google also provides two interfaces for working with data: Google Cloud Console and command-line instrument gsutil.

- Data Transfer: Google Cloud Storage offers several options for importing and exporting data to and from the cloud.

 

Steps to Create a Google Cloud Storage Bucket

 

Via the Google Cloud Console

 

1. Log in to the Google Cloud Console.

2. Go to the Cloud Storage Buckets page.

3. Click on Create Bucket.

4. Enter a unique bucket name that meets the bucket name requirements.

5. Select the Location Type and Location where you want to store your data.

6. Choose a Storage Class for your data.

7. Select an Access Control model for your bucket's objects.

8. Configure Protection Tools and Data Encryption if desired.

9. Click Create to create your bucket.

 

Via the gsutil Command-Line Tool

 

You can use the gsutil mb command to create a bucket:

 

$ gsutil mb gs://[BUCKET_NAME]/

 

Replace [BUCKET_NAME] with the name you wish to set for your bucket and conform to the naming conventions above. For example:

 

$ gsutil mb gs://my-bucket/

 

You can set the following optional flags to have greater control over the bucket creation:

 

- p: Specify the project with which your bucket will be associated.

- c: Specify the default storage class of your bucket.

- l: Specify the location of your bucket.

- b: Enable uniform bucket-level Access to your bucket.

 

Accessing Data in Your Bucket

 

Using gsutil

 

To list the contents of your bucket:

 

$ gsutil ls gs://my-cloud-bucket/

 

Output:

gs://my-cloud-bucket/myFile.txt

gs://my-cloud-bucket/myOtherFile.txt

 

Using GCSFuse

 

GCSFuse allows you to mount a bucket or a sub-directory of a bucket to your VM directory. This way, you can access the bucket data without using gsutil or gs:// addresses.

To mount a bucket to your folder:

 

$ gcsfuse bucket name my folder/to/mount

 

To mount a sub-directory from your bucket to your VM folder:

 

$ gcsfuse --only-dir subdirectory bucketName myFolder/to/mount

 

Keep in mind that using GCSFuse will download the data to your directory, so make sure your VM instance has enough available storage.

 

Conclusion

 

To create a bucket in Google Cloud Storage, one can do it via Google Cloud Console or with the help of the gsutil utility. More or less, buckets offer dynamic features like version, time parameters for data dealing, and various ways of data transfer and can be a cost-effective solution for different occasions of storage and management.

Cut Hosting Costs! Submit Query Today!

Grow With Us

Let’s talk about the future, and make it happen!