Command-line Access to Google Cloud Storage

Since our September release of MinIO Client ‘mc’ for Amazon S3 and MinIO server, we received number of requests to also support Google cloud storage, Red Hat Ceph and Open Stack Swift.

Here is the Amazon S3 API compatibility matrix for various server implementations.

Previous release of ‘mc’ only supported latest Amazon S3 V4 API signature. We have now added support for older V2 APIs and tested against Google Cloud Storage service.

This is a step by step guide to access Google cloud storage service using ‘mc’.

Setup a project under Google Developer Console

To access Google Cloud Storage, first step is to create project. Click on the following link, https://console.developers.google.com/storage and scroll down to enable storage option on the sidebar.

The following screen will pop up.

Activate S3 API compatibility

To use mc with google cloud storage, you need to activate the S3 API compatibility. It is OFF by default.

Settings > Interoperability >Enable interoperability access

Once interoperability access is enabled the following screen will pop up.

Click on create new key, It will give you an access key and secret key. Note them down.

How to install mc

Once the above steps are complete, mc is ready for use with Google Cloud Storage.

If you have an old version of mc installed, you can update to a newer release via update command.

  • mc update release

Basic operations via mc on google cloud:

To configure mc to access google cloud storage service, you need to enter the access & secret key along with host information via config command.

NOTE: Google Cloud Storage only supports Legacy Signature Version 2, so you have to pick — S3v2

You may also create an alias for convenience.

  • mb command to make buckets in google cloud.
  • ls command to list buckets & contents
  • cp command to copy files & folders
  • cat Command: Display the contents of files
  • rm Command: Remove a file from existing bucket

To see the complete list of functionality for mc please refer to https://github.com/minio/mc

Alternative to MinIO Client

Google has its own CLI tool called gsutil to access cloud storage. It is written in Python and uses native Google Cloud Storage JSON APIs. Learn more about gsutil at https://cloud.google.com/storage/docs/gsutil?hl=en