Use the gsutil CLI

Connect to Granica with gsutil for GCS bucket management.

Configuring gsutil to connect to Granica allows you to manage crunched data using standard gsutil commands. Once configured, GCS API requests made with the CLI will be redirected to Granica for handling by Crunch. You can easily and consistently access all your data, whether crunched or not, without complicated environment modifications. Any requests for objects not crunched by Crunch are simply passed through directly to GCS. Having Granica as the single endpoint for all GCS requests greatly simplifies your application code.

Install the gcloud and gsutil CLIs

Granica works with the gsutil CLI, which is included as part of the Google Cloud SDK. If you don't already have it installed, you can follow Google’s installation instructions to install the gcloud and gsutil CLIs on your local machine. Then run the following command to log in with your Google credentials.

gcloud auth login

Use gsutil to interact with Granica

The gsutil CLI can be used to connect to the Granica API server after deployment.

You'll need the Granica HTTPS endpoint set up during deployment, which should look something like bolt.<REGION>.<CUSTOM_DOMAIN>. If you haven't set up a custom domain for the deployment, you can find instructions for doing so in our start pilot guide.

Create a ~/.boto configuration file (or edit your existing one) to include an override for the gs_json_host field in the Credentials section that points to the BOLT_URL.

[Credentials]
gs_json_host = <BOLT_URL>

After the file is configured, gsutil operations should work as normal, but will now create and read objects via Granica instead of directly via GCS.

By adding the ~/.boto config file, all gsutil operations will automatically be redirected to Granica. If you still want to make some requests directly to GCS, for example to compare performance between Granica and GCS APIs, you can use the -o option to override the host on a per-command basis, instead of creating the ~/.boto file:

gsutil -o Credentials:gs_json_host=<BOLT_URL> <COMMAND> <PARAMETERS>
note

The IAM principal (user or role) used to make the requests to Granica must be granted the necessary permissions. See the command documentation for permissions for more info on authorizing access through Granica.

See also