AWS › S3 & Storage
How do S3 lifecycle policies automatically transition objects between storage classes or delete them entirely based on defined rules?
IntermediateAnswer
S3 lifecycle policies let you define rules that automatically transition objects to a different, typically cheaper, storage class after a specified number of days, or automatically delete objects entirely after they are no longer needed, removing the need to manually manage the ongoing storage class and retention of potentially millions of individual objects yourself.
aws s3api put-bucket-lifecycle-configuration --bucket my-bucket --lifecycle-configuration file://lifecycle-policy.jsonReal-world example A company configures a lifecycle policy that automatically moves log files older than thirty days into S3 Infrequent Access, then into Glacier after ninety days, and finally deletes them entirely after seven years to meet their data retention policy, all without any manual intervention.