Mount Google Cloud Storage Bucket In Linux

Software Requirements for this process

Google Cloud SDK Installation

The Cloud SDK is a set of tools for Cloud Platform. It contains gcloud, gsutil, and bq, which you can use to access Google Compute Engine, Google Cloud Storage, Google BigQuery, and other products and services from the command line. You can run these tools interactively or in your automated scripts.

Step 1: Download the Cloud SDK archive file:

Linux (x86_64)  :

Linux (x86)  :

Step 2:

Now, extract the downloaded file to any location on your file system.

Step 3:

This step is an optional. Run the install script to add Cloud SDK tools to your path and enable the command completion in your bash shell, and/or and enable usage reporting

It will add the commands in /root/.bashrc. After that, execute the below command in order to make it work in the current shell.

After completing the installation now we need to authenticate the Google Cloud in SDK. Run the core gcloud commands to authenticate your SDK to your Google Cloud account:

o authenticate run:

Step 5:

Visit the URL by using the browser and sign in using your Google Cloud account.

Step 6:

After sigining in using your account, you will get a verification code and now verify yourself with your verification code.

Step 7:

After getting verified, you will be able to complete the authentication of SDK.

Step 8:

Now to verify your Google Cloud account is active or not use the following command.

After the activation now it’s time to get the authentication key. In order to get the default key use the below command.

Step 9:

Again, the browser-level login URL will be generated and repeat the steps 5 & 6.

Once the steps have been completed successfully, the auth key will be saved in a JSON file [/root/.config/gcloud/application_default_credentials.json]. These credentials will be used by any library that requests Application Default Credentials.

FUSE Installation

Cloud Storage FUSE is an open source plugin that allows you to mount Google Cloud Storage buckets as file systems on Linux or OS X systems. It also provides a way for applications to upload and download Google Cloud Storage objects using standard file system semantics.

Cloud Storage FUSE can be run anywhere with connectivity to Google Cloud Storage, including Google Compute Engine VMs or on-premises systems


Before invoking gcsfuse, you must have a GCS bucket that you want to mount. If your bucket doesn’t yet exist, create one using the Google Developers Console. GCS credentials are automatically loaded using Google application default credentials, or a JSON key file can be specified explicitly using –key

Step 1:

Configure the gcsfuse using yum repo:

Step 2:

To install the gcsfuse use the following command.

Step 3:

To mount a bucket using gcsfuse over an existing directory /path/to/mount, invoke it like the following,

The gcsfuse tool will exit successfully after mounting the file system. Unmount in the usual way for a fuse file system on your operating system:

Wrapping Up

To mount the google bucket on system startup, add below line in fstab.