Question

Difficulty: EasyDeploying and Configuring Cloud Storage Buckets and Objects

A cloud engineer needs to update an existing Google Cloud Storage bucket named `analytics-raw-data-logs` so that any new objects uploaded to the bucket are assigned the Nearline storage class by default. Which Google Cloud CLI command should the engineer run to accomplish this task?

  1. gcloud storage buckets update gs://analytics-raw-data-logs --default-storage-class=nearlineAnswer
  2. B
    gsutil defstorageclass set nearline gs://analytics-raw-data-logs
  3. C
    gcloud storage buckets create gs://analytics-raw-data-logs --default-storage-class=nearline
  4. D
    gcloud compute buckets update gs://analytics-raw-data-logs --default-storage-class=nearline

Answer

The command `gcloud storage buckets update gs://analytics-raw-data-logs --default-storage-class=nearline` correctly configures the default storage class of an existing bucket.
The command `gcloud storage buckets update gs://analytics-raw-data-logs --default-storage-class=nearline` uses the correct `gcloud storage` syntax to modify an existing bucket and set its default storage class to Nearline.

Step-by-Step Solution

1
Identify the CLI tool standard
Google Cloud recommends using `gcloud storage` for Cloud Storage management.
The `gcloud storage` CLI provides unified resource management syntax for Cloud Storage resources.
2
Determine the resource operation
Since the bucket already exists, use `gcloud storage buckets update` rather than `create`.
Modifying existing bucket properties requires an update command.
3
Specify the configuration flag
Pass `--default-storage-class=nearline` with the target bucket URI `gs://analytics-raw-data-logs`.
This sets the default storage class applied to future object uploads within the bucket.

Key Concept

Configuring Cloud Storage Bucket Default Storage Class via gcloud CLI
Rate this question