Sat Apr 18 2026

Google Cloud Storage

Google cloud SDK provides tools and libraries to programmatically interact with goolge cloud resources. The tools come in both as a CLI and in various programming languages.

  • The Google Cloud CLI manages the autthentication, configuration, and general settings for the google cloud.
  • The language-specific libraries provide API in various languages to interact with the google cloud resources.

Follow the tutorial to install Google Cloud CLI Install the Google Cloud CLI .

All the python libraries for google cloud are listed in Python Cloud Client Libraries.

We use the python library google-cloud-storage for managing and creating objects in the cloud storage. More info is available at Python Client for Google Cloud Storage.

  • Install the library using pip install google-cloud-storage.
  • After installing, one needs to initialize the CLI using gcloud init to configure the gcloud.
  • For local shell, create the local autthentication credentials for the account using gcloud auth application-default login. This asks for the authentication and saves the credentials to /home/user/.config/gcloud/application_default_credentials.json. Any time a gcloud library interacts with the cloud, it uses the local credentials to authenticate.
  • To set another project to the cli use gcloud config set project PROJECT_ID.
  • To view the current project added to the cli, run gcloud config get-value project.
  • To display the list of buckets in the project, run gcloud storage buckets list.

Note: After changing the project to existing gcloud, you may need to authenticate again using gcloud auth application-default login.

Buckets can be used using the python library using the following.

from google.cloud.storage import Client

client = Client()

bucket_name = "bucket_name"
bucket = client.get_bucket(bucket_name)
print(bucket)

Object Storage with Google CLI