def set_default_lifecycle_rules(self): """ Sets lifecycle rule by default """ self.add_lifecycle_rule( abort_incomplete_multipart_upload_after=core.Duration.days(7), enabled=True ) self.add_lifecycle_rule( noncurrent_version_transitions=[ s3.NoncurrentVersionTransition( storage_class=s3.StorageClass.INFREQUENT_ACCESS, transition_after=core.Duration.days(30) ), s3.NoncurrentVersionTransition( storage_class=s3.StorageClass.GLACIER, transition_after=core.Duration.days(60) ) ] ) self.add_lifecycle_rule( noncurrent_version_expiration=core.Duration.days(360) )
def lifecycle_rules(bucket): bucket.add_lifecycle_rule( abort_incomplete_multipart_upload_after=core.Duration.days(7), enabled=True) bucket.add_lifecycle_rule(noncurrent_version_transitions=[ s3.NoncurrentVersionTransition( storage_class=s3.StorageClass.INFREQUENT_ACCESS, transition_after=core.Duration.days(30)), s3.NoncurrentVersionTransition( storage_class=s3.StorageClass.GLACIER, transition_after=core.Duration.days(60)) ]) bucket.add_lifecycle_rule( noncurrent_version_expiration=core.Duration.days(360))