Question

Difficulty: MediumDeploying and Configuring Cloud Storage Buckets and Objects

Your organization needs to configure an automated lifecycle policy for a Google Cloud Storage bucket used to store audit logs. The policy must automatically transition objects from Standard to Nearline storage after 30 days and permanently delete them after 365 days. You want to accomplish this using the modern Google Cloud CLI. Which approach should you take to deploy this configuration?

  1. Create a JSON configuration file defining the lifecycle rules with Age conditions and corresponding SetStorageClass and Delete actions, then run gcloud storage buckets update gs://[BUCKET_NAME] --lifecycle-file=[FILE_PATH].Answer
  2. B
    Create a lifecycle configuration file and execute gsutil lifecycle set [FILE_PATH] gs://[BUCKET_NAME] to deploy the rules.
  3. C
    Define the transition and deletion schedules inside an IAM policy JSON document and apply it using gcloud storage buckets set-iam-policy gs://[BUCKET_NAME] policy.json.
  4. D
    Deploy the bucket with Nearline as its default storage class upon creation and configure object-level retention policies on individual uploads to handle automatic deletion.

Answer

Create a JSON configuration file defining the lifecycle rules with Age conditions and corresponding SetStorageClass and Delete actions, then run gcloud storage buckets update gs://[BUCKET_NAME] --lifecycle-file=[FILE_PATH].
The correct approach is to create a JSON file defining condition rules (age in days) and actions (SetStorageClass to NEARLINE at 30 days, Delete at 365 days), and update the bucket configuration using gcloud storage buckets update gs://[BUCKET_NAME] --lifecycle-file=[FILE_PATH]. This follows Google-recommended practices using modern gcloud CLI tools.

Step-by-Step Solution

1
Define the Object Lifecycle Management rule in JSON format.
A JSON file containing two rules: one with condition 'age: 30' and action 'SetStorageClass' to 'NEARLINE', and another with condition 'age: 365' and action 'Delete'.
Lifecycle rules require condition matching (such as object age) to trigger automated storage actions.
2
Apply the lifecycle configuration file to the Cloud Storage bucket using the modern CLI tool.
The bucket is updated with the lifecycle management rules using gcloud storage buckets update with the --lifecycle-file flag.
Google Cloud recommends using the gcloud storage CLI command set for deploying bucket lifecycle policies.

Key Concept

Cloud Storage Object Lifecycle Management configuration using gcloud storage
Rate this question