
Answer-first summary for fast verification
Answer: Write a lifecycle management rule in JSON and push it to the bucket with gsutil
The correct answer is **B** because the object lifecycle in Cloud Storage can be automatically managed using a JSON document that defines the rules. This method is more efficient and less cumbersome than manually listing and deleting objects. Refer to the GCP documentation for `gsutil lifecycle` for more details. Option A is incorrect because XML is not supported by the `gsutil` command for lifecycle configurations. Options C and D are inefficient as they involve manually listing objects, calculating their age, and then deleting them, which is not optimal for ongoing cost management.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
You are tasked with optimizing ongoing Cloud Storage spend by removing backup files older than 90 days from your backup Cloud Storage bucket. What is the most efficient method to achieve this?
A
Schedule a cron script using gsutil ls –l gs://backups/** to find and remove items older than 90 days and schedule it with cron
B
Write a lifecycle management rule in JSON and push it to the bucket with gsutil
C
Schedule a cron script using gsutil ls –lr gs://backups/** to find and remove items older than 90 days
D
Write a lifecycle management rule in XML and push it to the bucket with gsutil
No comments yet.