Associate Cloud Engineer ยท Managing Cloud Storage and encryption keys
What is a Cloud Storage lifecycle rule?
Lifecycle rules: conditions (age, storage class, versions) and actions (SetStorageClass, Delete), applying a JSON config with gcloud, rule timing.
Key points
- A rule on a bucket that pairs conditions (such as age, matchesStorageClass, numNewerVersions) with an action (SetStorageClass or Delete).
- An object must meet all conditions of a rule.
- Rules are applied from a JSON file with gcloud storage buckets update --lifecycle-file, and actions run asynchronously, so timing is not exact.
Source: https://docs.cloud.google.com/storage/docs/lifecycle
Practice questions
Which lifecycle action moves an object to a colder storage class?
- Delete
- SetStorageClass
- AbortIncompleteMultipartUpload
- Rewrite
Show answer
Answer: B. SetStorageClass
SetStorageClass changes the class. Delete removes the object, and AbortIncompleteMultipartUpload cleans up unfinished uploads.
Which of these are valid lifecycle rule conditions?
- age
- contentType
- numNewerVersions
- uploaderEmail
- matchesStorageClass
Show answer
Answer: A. age, C. numNewerVersions, E. matchesStorageClass
age, numNewerVersions and matchesStorageClass are real conditions. Lifecycle rules cannot filter on content type or on the identity of the uploader.
True or false: a lifecycle action runs at the exact moment an object meets the rule's conditions.
Show answer
Answer: False
False. Actions run asynchronously, so there can be a delay, and configuration changes may take up to 24 hours to take effect.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
