A DevOps team needs to set up a Google Cloud Storage bucket named `iot-log-repository` in the `europe-west1` region to hold daily application logs. The team has prepared a local configuration file named `lifecycle.json` containing lifecycle rules to transition objects to Nearline storage after 30 days and delete them after 365 days. Which set of commands represents the Google-recommended approach using the modern Google Cloud CLI to provision the bucket and apply this lifecycle policy?
- Run `gcloud storage buckets create gs://iot-log-repository --location=europe-west1` followed by `gcloud storage buckets update gs://iot-log-repository --lifecycle-file=lifecycle.json`.Cevap
- BRun `gsutil mb -l europe-west1 gs://iot-log-repository` followed by `gcloud storage buckets update gs://iot-log-repository --lifecycle-file=lifecycle.json`.
- CRun `gcloud storage buckets create gs://iot-log-repository --location=europe-west1 --default-storage-class=NEARLINE` without applying the lifecycle JSON policy file.
- DRun `gcloud storage buckets create gs://iot-log-repository --location=europe-west1` followed by `gcloud storage objects update gs://iot-log-repository/* --lifecycle-file=lifecycle.json`.
Cevap
Execute `gcloud storage buckets create gs://iot-log-repository --location=europe-west1` to provision the bucket, then execute `gcloud storage buckets update gs://iot-log-repository --lifecycle-file=lifecycle.json` to assign the lifecycle policy.
The standard Google-recommended command for provisioning a Cloud Storage bucket is `gcloud storage buckets create`. Modifying bucket properties, including setting lifecycle management rules from a JSON specification file, is accomplished via `gcloud storage buckets update --lifecycle-file=FILENAME`.
Adım Adım Çözüm
Anahtar Kavram
Cloud Storage Bucket Provisioning and Lifecycle Management with gcloud storage CLI