I want to create Amazon Simple Storage Service (Amazon S3) Lifecycle configuration rules for noncurrent object versions.
Resolution
Configure a lifecycle rule to transition noncurrent objects
To transition noncurrent versions, Amazon S3 uses the NoncurrentVersionTransition action. Use this action to specify when Amazon S3 must transition objects to a specified storage class.
To create a lifecycle rule for transitioning noncurrent object versions, complete the following steps:
- Open the Amazon S3 console.
- Select the bucket that you want to create the lifecycle rule for.
- Choose the Management tab, and then choose Create lifecycle rule.
- For Lifecycle rule name, enter a name for your rule.
- For Choose a rule scope, take the following actions:
To apply the lifecycle rule for a particular prefix, choose Limit the scope of this rule using one or more filters. Then, enter the prefix name.
To apply the lifecycle rule for the whole bucket, choose Apply to all objects in the bucket. Then, choose I acknowledge that this rule will apply to all objects in the bucket.
- Under Lifecycle rule actions, choose Transition noncurrent versions of objects between storage classes to create a lifecycle rule.
- In the Transition noncurrent versions of objects between storage classes field, take the following actions:
For Choose storage class transitions, choose the desired storage class.
For Days after objects become noncurrent, enter the number of days that the object can be noncurrent before S3 transitions the object version.
For Number of newer versions to retain, choose the number of noncurrent versions that you want to retain in the storage class.
Note: The total number of retained versions includes all noncurrent versions and one current version.
- Choose Create rule.
Important: If the rule doesn't contain any errors, then Amazon S3 turns it on. To view the rule, choose the Management tab, and then choose Lifecycle rules.
Configure a lifecycle rule for expiration of noncurrent objects
To delete noncurrent versions, Amazon S3 uses the NoncurrentVersionExpiration action. Use this action to specify when Amazon S3 must permanently delete noncurrent versions of objects. Note that you can't recover these deleted objects.
To create a lifecycle rule for expiration of noncurrent object versions, complete the following steps:
- Open the Amazon S3 console.
- Select the bucket that you want to create the lifecycle rule for.
- Choose the Management tab, and then choose Create lifecycle rule.
- For Lifecycle rule name, enter a name for your rule.
- For Choose a rule scope, take the following actions:
To apply this lifecycle rule for a particular prefix, choose Limit the scope of this rule using one or more filters. Then, enter the prefix name.
To apply the lifecycle rule for the whole bucket, choose Apply to all objects in the bucket. Then, select I acknowledge that this rule will apply to all objects in the bucket.
- Under Lifecycle rule actions, choose actions to create a lifecycle rule.
Choose Permanently delete noncurrent versions of objects to specify when Amazon S3 deletes objects and how many versions to retain.
For Days after objects become noncurrent, enter the number of days that the object can be noncurrent before S3 permanently deletes them.
For Number of newer versions to retain, select the number of versions that you want to retain in the storage class.
Note: The total number of retained versions includes the number of newer noncurrent versions that you chose to retain and one current version. Amazon S3 updates the total number as S3 Lifecycle expires and deletes objects.
- Choose Create rule.
Important: If the rule doesn't contain any errors, then Amazon S3 turns it on. To view the rule, choose the Management tab, and then choose Lifecycle rules.