Question

Difficulty: MediumDeploying and Configuring Cloud Storage Buckets and Objects

A logistics enterprise is deploying a telemetry ingestion pipeline on Google Cloud. The cloud architecture team needs to provision a dedicated Cloud Storage bucket named `telemetry-logs-prod` in the `us-east4` region. According to corporate policy, the bucket must enforce Uniform Bucket-Level Access upon creation, and an existing lifecycle configuration file named `lifecycle.json` must be applied to automatically transition log objects older than 30 days to Nearline storage. Which TWO `gcloud storage` commands should you run to meet these requirements?

  1. gcloud storage buckets create gs://telemetry-logs-prod --location=us-east4 --uniform-bucket-level-accessAnswer
  2. B
    gsutil mb -l us-east4 -b on gs://telemetry-logs-prod
  3. gcloud storage buckets update gs://telemetry-logs-prod --lifecycle-file=lifecycle.jsonAnswer
  4. D
    gcloud storage buckets update gs://telemetry-logs-prod --default-storage-class=NEARLINE

Answer

Executing `gcloud storage buckets create gs://telemetry-logs-prod --location=us-east4 --uniform-bucket-level-access` to provision the bucket and `gcloud storage buckets update gs://telemetry-logs-prod --lifecycle-file=lifecycle.json` to attach the object lifecycle policy.
To create a bucket with Uniform Bucket-Level Access in a specific region using current Google Cloud standards, use `gcloud storage buckets create` with `--location` and `--uniform-bucket-level-access`. To apply age-based transition rules from a local JSON file, execute `gcloud storage buckets update` with the `--lifecycle-file` flag.

Step-by-Step Solution

1
Provision the Cloud Storage bucket with Uniform Bucket-Level Access enabled.
Bucket `gs://telemetry-logs-prod` is created in region `us-east4` using `gcloud storage buckets create` with the `--uniform-bucket-level-access` flag.
Google Cloud recommends using the `gcloud storage` CLI over legacy `gsutil` for bucket creation and configuration.
2
Apply the Object Lifecycle Management configuration file.
The bucket configuration is updated with `--lifecycle-file=lifecycle.json` using `gcloud storage buckets update`.
Lifecycle rules transition objects based on age conditions, which requires applying a lifecycle JSON file rather than modifying the bucket's default storage class.

Key Concept

Deploying Cloud Storage buckets and configuring object lifecycle policies using the gcloud storage CLI tool.
Rate this question