Open In App

How To Create GCP Bucket Using CLI ?

Last Updated : 26 Mar, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Users can store and manage their data in the cloud with Google Cloud Storage (GCS), the service is provided by the Google Cloud Platform (GCP). Having the big virtual hard drive to store files, documents, photos, movies, and other media is similar to that.

Within Google Cloud Storage, a bucket refers to a folder or container where you can group and store your data. The bucket can store a lot of data and has a special name. Using buckets, you may manage file access and storage. They also offer features like versioning, lifecycle management, and access control to help you manage your data efficiently.

Steps to Create GCP Bucket Using CLI

Step 1: Activate Cloud Shell by clicking Cloud Shell on the GCP console.

GCP Console

Authorize to cloud shell by clicking the authrozie as shown image below.

Authorize

Step 2: Verify the gcloud installed or not using the below command. If gcloud is not installed you can install the gcloud by following the link.

Gcloud

Step 3: Click on below command and authorize your project

gcloud auth login

Step 4: Aftre authorization click on below command and the bucket is created.

gsutil mb -p PROJECT_ID -c STORAGE_CLASS -l LOCATION gs://BUCKET_NAME

Enter your real values in the replacements:

  • PROJECT_ID: Your GCP project Id.
  • STORAGE_CLASS: The bucket’s storage class (standard, nearline, coldline, etc.).
  • LOCATION: The location for the bucket (e.g., us-central1, europe-west1).
  • BUCKET_NAME: The name for your bucket.

Create Bucket

Google Cloud Platforms (GCP) provides gsutil, a command-line tool for dealing with the Google Cloud Storage (GCS). It enables you to use your terminal or command prompt to carry out a number of tasks, include upload, download, copy, and deleting the files in GCS buckets. You can efficiently handle your cloud storage resources with gsutil without utilize the GCP Console interface.

Step 5: Vrify the bucket is created. Click on Storage and click on buckets.

Click on Storage

Step 6: Below image refers the bucket is created on GCP

Verify the Bucket

Some common use cases for Google Cloud Storage (GCS) buckets

  • Keeping and delivering content for static websites.
  • Data archiving and backup.
  • Archiving video and image material created by users.
  • Analyzing large datasets with BigQuery or other data processing services.
  • Integrating with other GCP services like Cloud Functions, Cloud Run, or AI Platform.
  • Sharing files and collaborating across teams or organizations.
  • Storing media assets for apps or streaming services.
  • Storing logs and telemetry data for monitoring and analysis.
  • Implementing disaster recovery and business continuity strategies.
  • Utilizing object storage to create apps that are robust and scalable.

Conclusion

Buckets from Google Cloud Storage (GCS) offer a dependable and expandable cloud data management and storage solution. GCS enables customers to effectively manage their data and develop creative solutions on Google Cloud Platform with easy-to-follow instructions for creating buckets using the CLI and a wide range of use cases, from data analysis to website hosting. For developers, data scientists, and company owners alike, GCS provides the adaptability and dependability required to meet your cloud storage needs.

How do I create a public bucket in GCP?

To create a public bucket in GCP, first, create the bucket using the gsutil mb command, then set the bucket’s default ACL to include the allUsers group with the READ permission.

What is gsutil command line tool?

The gsutil command-line tool is provided by Google Cloud Platform (GCP) to interact with Google Cloud Storage (GCS). It allows users to perform various operations such as uploading, downloading, copying, and managing objects and buckets in GCS from the terminal or command prompt.

What is a bucket in GCP?

A bucket in Google Cloud Platform (GCP) is a container for storing data objects in Google Cloud Storage (GCS). It provides a way to organize and manage data, offering features like versioning, access control, and lifecycle management.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads