GCS Lifecycle Rules – Lifecycle Conditions

E.g. All versions that are not LIVE (and 30 days old) to be deleted. All other versions to be moved to COLDLINE (after 365 day)

{"lifecycle": 
  { "rule": 
     [ { "action": { "type": "Delete"}, "condition": { "age": 30, "IsLive": false } }, 
    { "action": { "type": "SetStorageClass", "storageClass": "COLDLINE" }, "condition": { "age": 365, "matchesStorageClass": ["NEARLINE"] } }]}}
  1. Run the gsutil lifecycle set command as following.  gsutil lifecycle set [JSON file] gs://[YOUR CLOUD ...

A lifecycle rule includes conditions which an object must meet before the action defined in the rule occurs on the object. Lifecycle rules support the following conditions:

anuj

I am passionate about getting cloud solutions right the first time. I help customers transition to the public cloud with the appropriate security controls and guardrails. GCP, AWS and Azure Security Specialist. <a href="https://calendly.com/anujvarma/google-cloud-architect-initial-consultation">Initial Consultation</a>

Leave a reply

Your email address will not be published. Required fields are marked *