Soru

Zorluk: OrtaDeploying and Configuring Cloud Storage Buckets and Objects

A DevOps team needs to optimize storage costs for an application logs bucket named `app-logs-prod` by automatically transitioning objects older than 30 days to Nearline Storage and deleting objects older than 365 days. The configuration must be applied using Google Cloud's current recommended CLI tooling. Which command should the team run to apply the local lifecycle configuration file named `lifecycle.json` to the bucket?

  1. gcloud storage buckets update gs://app-logs-prod --lifecycle-file=lifecycle.jsonCevap
  2. B
    gsutil lifecycle set lifecycle.json gs://app-logs-prod
  3. C
    gcloud compute buckets update gs://app-logs-prod --lifecycle-file=lifecycle.json
  4. D
    gcloud storage objects update gs://app-logs-prod --lifecycle-file=lifecycle.json

Cevap

The command `gcloud storage buckets update gs://app-logs-prod --lifecycle-file=lifecycle.json` correctly updates the Cloud Storage bucket with the lifecycle rules.
The command starting with `gcloud storage buckets update` correctly specifies the bucket resource group and uses the `--lifecycle-file` flag to attach a JSON lifecycle configuration to an existing Cloud Storage bucket following current GCP CLI best practices.

Adım Adım Çözüm

1
Identify the recommended CLI tool
Google Cloud recommends using `gcloud storage` commands rather than legacy `gsutil` commands.
gcloud storage offers faster performance and consistent gcloud CLI flags.
2
Determine the targeted resource tier and flag
Lifecycle policies are bucket-level configurations applied using `gcloud storage buckets update` with the `--lifecycle-file` flag.
Bucket properties govern object management rules automatically across all matching objects in that bucket.

Anahtar Kavram

Deploying Cloud Storage Bucket Lifecycle Configurations with gcloud CLI
Bu soruyu puanla