Skip to main content

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.

ClassMin Storage DurationAccess FrequencyRetrieval CostTypical Use Case
StandardNoneFrequent / real-timeNoneActive media, serving content, hot data
Nearline30 days~Once a monthLowMonthly backups, data accessed infrequently
Coldline90 days~Once a quarterMediumQuarterly DR snapshots, archival
Archive365 days~Once a yearHighLong-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​

ActionWhat It Does
SetStorageClassTransitions object to a cheaper class
DeletePermanently 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
  • SetStorageClass rules 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