Google Associate Cloud Engineer Question 237
Single answerGoogle Cloud PlatformYou are managing a Cloud Storage bucket that stores log files. To optimize storage costs, you want to automatically delete objects that are older than 365 days. How can you achieve this using Google Cloud's object lifecycle management feature?
- A
A. Create a lifecycle rule with a condition to delete objects older than 365 days.
- B
B. Schedule a Cloud Function to run daily and delete objects older than 365 days.
- C
C. Use Stackdriver Monitoring to trigger deletion of objects older than 365 days.
- D
D. Set up a cron job on a Compute Engine instance to delete objects older than 365 days.
Show answer and explanation
Correct answer: A
Explanation
Google Cloud's object lifecycle management feature allows you to create lifecycle rules to automatically perform actions on objects, such as deleting them when they meet specific conditions (e.g., reaching a certain age). This is a more efficient and cost-effective solution for managing storage lifecycle than manually scheduling tasks using external services.
- A. Correct.
A lifecycle rule allows you to define conditions under which objects are automatically deleted, such as being older than a certain number of days.
- B. Incorrect.
While you could use a Cloud Function to achieve this, it's not the most efficient or intended use for managing storage lifecycle.
- C. Incorrect.
Stackdriver Monitoring is not used for managing object lifecycles in Cloud Storage; it is meant for monitoring and alerting.
- D. Incorrect.
Using a cron job on a Compute Engine instance is a less efficient and more complex solution compared to using Cloud Storage's built-in lifecycle management.