Soru

Zorluk: OrtaDeploying and Configuring Cloud Storage Buckets and Objects

A cloud administrator needs to automate object lifecycle management on an existing Google Cloud Storage bucket to transition objects older than 30 days to Nearline storage. Arrange the operational steps in the correct sequence to define, apply, and verify the lifecycle policy using the modern `gcloud storage` CLI tool.

  1. 1Construct a local JSON policy file (e.g., `lifecycle.json`) defining the `SetStorageClass` action to `NEARLINE` for objects matching the `age` condition of 30 days.
  2. 2Execute `gcloud storage buckets update gs://[BUCKET_NAME] --lifecycle-file=lifecycle.json` to bind the policy rules to the bucket.
  3. 3Run `gcloud storage buckets describe gs://[BUCKET_NAME] --format="json(lifecycle)"` to inspect and confirm the active configuration.
  4. 4Upload a sample object using `gcloud storage cp test-file.txt gs://[BUCKET_NAME]/` to test bucket operations under the updated policy.

Cevap

The correct operational sequence is: First, create the local JSON lifecycle policy file specifying the action and age conditions. Second, deploy the policy file to the target bucket using `gcloud storage buckets update --lifecycle-file`. Third, verify the applied policy using `gcloud storage buckets describe`. Fourth, test write operations on the bucket by uploading a test file with `gcloud storage cp`.
The operational workflow for deploying Cloud Storage bucket lifecycle rules follows standard cloud infrastructure configuration steps: policy definition in a local manifest, execution of the updating CLI command to sync changes to GCP, metadata verification to ensure the deployment succeeded, and functional validation through an object upload test.

Adım Adım Çözüm

1
Draft the lifecycle JSON configuration file
A local file named `lifecycle.json` containing the transition rule definition is created.
The `gcloud storage` CLI requires lifecycle policies to be supplied via a structured JSON document.
2
Deploy the policy file to Google Cloud Storage
The command `gcloud storage buckets update gs://[BUCKET_NAME] --lifecycle-file=lifecycle.json` applies the lifecycle rule to the cloud resource.
Bucket configuration updates must be committed to the GCP control plane before they can take effect.
3
Verify active lifecycle rules on the bucket
Executing `gcloud storage buckets describe` displays the active lifecycle object within the bucket metadata.
Verification confirms that the configuration was parsed and accepted by Cloud Storage without formatting errors.
4
Perform post-deployment operation testing
Running `gcloud storage cp` successfully uploads an object to the configured bucket.
Testing ensures bucket access controls and object write pathways remain functional after updating bucket metadata.

Anahtar Kavram

Configuring Cloud Storage Object Lifecycle Policies using gcloud storage CLI
Bu soruyu puanla