nerdexam
Google

ASSOCIATE-CLOUD-ENGINEER · Question #338

The storage costs for your application logs have far exceeded the project budget. The logs are currently being retained indefinitely in the Cloud Storage bucket myapp-gcp-ace-logs. You have been asked

The correct answer is B. Write a lifecycle management rule in JSON and push it to the bucket with gsutil lifecycle set. To automatically remove logs older than 90 days from a Cloud Storage bucket and optimize costs, implement a lifecycle management rule defined in JSON and apply it to the bucket.

Submitted by neha2k· Mar 30, 2026Planning and configuring a cloud solution

Question

The storage costs for your application logs have far exceeded the project budget. The logs are currently being retained indefinitely in the Cloud Storage bucket myapp-gcp-ace-logs. You have been asked to remove logs older than 90 days from your Cloud Storage bucket. You want to optimize ongoing Cloud Storage spend. What should you do?

Options

  • AWrite a script that runs gsutil Is -| ?gs://myapp-gcp-ace-logs/** to find and remove items older
  • BWrite a lifecycle management rule in JSON and push it to the bucket with gsutil lifecycle set
  • CWrite a lifecycle management rule in XML and push it to the bucket with gsutil lifecycle set config-
  • DWrite a script that runs gsutil Is -Ir gs://myapp-gcp-ace-logs/** to find and remove items older than

How the community answered

(40 responses)
  • A
    3% (1)
  • B
    90% (36)
  • C
    5% (2)
  • D
    3% (1)

Why each option

To automatically remove logs older than 90 days from a Cloud Storage bucket and optimize costs, implement a lifecycle management rule defined in JSON and apply it to the bucket.

AWrite a script that runs gsutil Is -| ?gs://myapp-gcp-ace-logs/** to find and remove items older

Writing and maintaining a custom script for deletion is less efficient, more prone to errors, and incurs compute costs compared to Cloud Storage's built-in lifecycle management.

BWrite a lifecycle management rule in JSON and push it to the bucket with gsutil lifecycle setCorrect

Cloud Storage Lifecycle Management rules automate object management based on predefined conditions, such as age, to delete old logs and optimize storage costs. These rules are configured using a JSON file, which is then applied to the bucket using the `gsutil lifecycle set` command, providing an efficient and automated solution.

CWrite a lifecycle management rule in XML and push it to the bucket with gsutil lifecycle set config-

Cloud Storage lifecycle management rules are defined in JSON format, not XML, making this option incorrect.

DWrite a script that runs gsutil Is -Ir gs://myapp-gcp-ace-logs/** to find and remove items older than

Similar to option A, a custom script is not the recommended or most cost-effective method for automating object deletion compared to Cloud Storage lifecycle management.

Concept tested: Cloud Storage Lifecycle Management for cost optimization

Source: https://cloud.google.com/storage/docs/managing-lifecycles

Topics

#Cloud Storage lifecycle#object expiration#gsutil lifecycle set#cost optimization

Community Discussion

No community discussion yet for this question.

Full ASSOCIATE-CLOUD-ENGINEER Practice