A DevOps engineer wants to automatically delete a Cloud Storage object after 30 days from creation. The object is stored in a bucket with the 'Standard' storage class. Which approach should the engineer use?
A bucket lifecycle rule supports an age-based Delete action, which automatically removes objects after a specified number of days from their creation time. By setting 'age: 30' in the Delete action, Cloud Storage will delete the objects exactly at the 30-day mark during its daily lifecycle evaluation. This is the native, recommended mechanism for automatic object expiration and directly fulfills the requirement.
Why this answer
A lifecycle rule in Cloud Storage allows automatic deletion of objects after a specified age, such as 30 days from creation. This is the standard method to manage object lifecycle and reduce storage costs. The rule can be applied to a bucket and will delete objects matching the criteria.
Exam trap
GCDL often tests the confusion between retention policies (which prevent deletion) and lifecycle rules (which perform deletion), leading candidates to choose retention when deletion is required.
How to eliminate wrong answers
Option A is wrong because a retention policy prevents deletion until the retention period expires; it does not delete objects. Option B is wrong because changing storage class to Archive does not automatically delete objects; it only changes storage class for cost savings. Option C is wrong because object versioning with noncurrent time deletion only deletes noncurrent versions after a period, not the live object.