Remove Backup Files Older Than 90 Days | Cloud Storage Optimization | Exam Answer

Optimizing Cloud Storage Spend - Removing Backup Files Older Than 90 Days

Question

You are creating a solution to remove backup files older than 90 days from your backup Cloud Storage bucket.

You want to optimize ongoing Cloud Storage spend.

What should you do?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

B.

The correct answer is B. Write a lifecycle management rule in JSON and push it to the bucket with gsutil.

Explanation:

To remove backup files older than 90 days from the Cloud Storage bucket and optimize ongoing Cloud Storage spend, you can use a lifecycle management rule. A lifecycle management rule defines the lifecycle of an object in a Cloud Storage bucket, and allows you to automate the deletion of older files.

Option A suggests writing a lifecycle management rule in XML and pushing it to the bucket with gsutil. While it is possible to use XML to create lifecycle management rules, JSON is the recommended format. XML is more complex and harder to read and modify than JSON.

Option C suggests scheduling a cron script using gsutil ls "lr gs://backups/** to find and remove items older than 90 days. This command lists all the objects in the bucket and pipes the output to the grep command to find objects that are older than 90 days. However, this approach is inefficient, as it requires listing all the objects in the bucket, which can be time-consuming and expensive for large buckets.

Option D is similar to option C, but with a typo in the command (should be "ls -l" instead of "ls l"). Moreover, this option schedules the cron script using cron, but this is not necessary if you use a lifecycle management rule.

Therefore, option B is the best answer as it suggests writing a lifecycle management rule in JSON and pushing it to the bucket with gsutil. This approach is more efficient and cost-effective, as it allows you to define the lifecycle of the objects in the bucket and automate the deletion of older files. The JSON format is also easier to read and modify than XML.