Cloud Storage: Classes and Lifecycle Policies
Storage Classesβ
Choose a storage class based on how frequently data is accessed and how long it must be retained.
| Class | Min Storage Duration | Access Frequency | Retrieval Cost | Typical Use Case |
|---|---|---|---|---|
| Standard | None | Frequent / real-time | None | Active media, serving content, hot data |
| Nearline | 30 days | ~Once a month | Low | Monthly backups, data accessed infrequently |
| Coldline | 90 days | ~Once a quarter | Medium | Quarterly DR snapshots, archival |
| Archive | 365 days | ~Once a year | High | Long-term compliance archives, legal hold |
Key rule: The less frequent the access, the lower the storage price but the higher the retrieval cost. Never choose a class solely on storage price β factor in how often data is read.
Lifecycle Policiesβ
Lifecycle rules automatically transition or delete objects based on conditions. Configured at the bucket level.
Common Actionsβ
| Action | What It Does |
|---|---|
SetStorageClass | Transitions object to a cheaper class |
Delete | Permanently deletes the object |
Conditions You Can Match Onβ
- Age β days since object was created
- CreatedBefore β objects created before a specific date
- IsLive β for versioned buckets:
true= current version,false= non-current version - NumNewerVersions β keep only N most recent versions, delete older ones
- MatchesStorageClass β only apply rule to objects already in a given class
Typical Lifecycle Pattern (media archive example)β
Day 0 β Standard (active / being served)
After 30d β Nearline (less active, monthly access)
After 90d β Coldline (quarterly DR / compliance)
After 365d β Archive (legal hold / long-term retention)
After 7 years β Delete (retention policy expired)
Versioning + Lifecycleβ
When object versioning is enabled, deleting a live object creates a non-current version (not permanently deleted). Use lifecycle rules to clean up non-current versions:
- Delete non-current versions older than N days
- Keep only the most recent N non-current versions
Without a lifecycle rule on non-current versions, storage costs grow unbounded.
Decision Guideβ
"Optimise storage costs for growing media volumes" (e.g. Altostrat)
β Enable versioning for safety + lifecycle policy to transition Standard β Nearline β Coldline β Archive by age. Add a Delete rule for non-current versions after a retention window.
"Compliance / legal hold β must retain for 7 years" β Archive class + Object Retention Lock or Bucket Lock (WORM policy). Prevents deletion or class downgrade before retention period expires.
"DR backup accessed once per quarter" β Coldline (90-day minimum matches quarterly access pattern, avoids early retrieval penalty).
"Disaster recovery β need to restore within hours" β Nearline or Standard, not Coldline/Archive (high retrieval latency and cost for frequent restores).
Exam Tipsβ
- Min storage duration penalties apply if you delete/transition an object before the minimum β you still pay for the full minimum period
SetStorageClassrules only move objects down (cheaper) β you cannot use lifecycle to move back up to Standard- Object Retention / Bucket Lock β versioning β locking prevents all deletion including by admins; versioning just preserves history
- Autoclass is an alternative to manual lifecycle rules: GCP automatically moves objects between Standard and Nearline/Coldline based on access patterns β useful when access patterns are unpredictable