Google Cloud Associate Data Practitioner — Question 14
You manage a Cloud Storage bucket that stores temporary files created during data processing. These temporary files are only needed for seven days, after which they are no longer needed. To reduce storage costs and keep your bucket organized, you want to automatically delete these files once they are older than seven days. What should you do?
Answer options
- A. Set up a Cloud Scheduler job that invokes a weekly Cloud Run function to delete files older than seven days.
- B. Configure a Cloud Storage lifecycle rule that automatically deletes objects older than seven days.
- C. Develop a batch process using Dataflow that runs weekly and deletes files based on their age.
- D. Create a Cloud Run function that runs daily and deletes files older than seven days.
Correct answer: B
Explanation
The correct answer is B because configuring a Cloud Storage lifecycle rule is specifically designed to manage the automatic deletion of objects based on their age, making it the most efficient solution for this scenario. Options A and D require additional scheduling and management, while C involves a more complex batch process that is unnecessary for this straightforward task.