Menu
Amazon Simple Storage Service
Console User Guide (API Version 2006-03-01)

Lifecycle Configuration for a Bucket with Versioning

Important

This is the User Guide for the old Amazon S3 console. If you are looking for the User Guide for the new Amazon S3 console, see Welcome to the New Amazon S3 Console User Guide.  

A versioning-enabled bucket can have many versions of the same object, one current version and zero or more noncurrent (previous) versions. You can add lifecycle rules to buckets that have object versioning enabled or suspended. Using a lifecycle configuration, you can define actions specific to current and noncurrent object versions. For information about lifecycle management and bucket versioning, see the following topics in the Amazon Simple Storage Service Developer Guide:

The combined lifecycle and versioning functionality acts like a recycling bin, granting you the following benefits:

  • Recovering previous versions for a specified time to protect against unintended overwrites or deletions of your content.

  • Setting specific windows of time for retaining the noncurrent versions in Amazon S3, archiving in Amazon Glacier, or scheduling automatic deletion to help you control storage costs.

The following example walkthrough adds the following lifecycle configuration to a versioning-enabled bucket.

  • Archive the current object versions in the documents folder 365 days after creation.

  • Transition noncurrent objects to the STANDARD_IA (infrequent access) storage class 30 days after they become noncurrent and transition them to the GLACIER storage class (archive them) 60 days after they become noncurrent. Permanently delete the noncurrent objects 425 days after they become noncurrent and remove expired object delete markers.

  • End and clean up multipart uploads that have not completed after 7 days.

Example: Add a Lifecycle Configuration Rule to a Versioned Bucket

  1. Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/.

  2. In the Buckets list, choose the bucket whose lifecycle configuration you want to configure, choose Properties, and then choose Lifecycle.

    
                Lifecycle - Bucket with Versioning

  3. Choose Add rule.

    
                Lifecycle - Bucket without Versioning

  4. Select A Prefix and enter documents/ as the prefix to specify the subset of objects to which the rule applies, and then click Configure Rule. (In our example, entering "documents/" will apply the rule to all objects in the bucket's "documents" folder.)

    For more information about key name prefixes and how they map to folders, go to Object Keys in the Amazon Simple Storage Service Developer Guide.

    If you selected Whole Bucket the rule would apply to all objects in the bucket.

  5. Configure the rule describing actions for both current and noncurrent (previous) object versions.

    1. In the Action on Current Version section select the Archive to the Glacier Storage Class and specify 365 days.

      Verify that the illustration in the EXAMPLE section match how you want your rule to work.

    2. Actions selected in the Action on Previous Versions section occur according to the specified number of days after the object becomes noncurrent.

      Select Transition to the Standard-Infrequent access Storage Class and enter 30 days, and then select Archive to the Glacier Storage Class and enter 60 days.

      Select Permanently Delete and enter 425 days and then select Remove expired object delete marker. Amazon S3 will remove an expired object delete marker no sooner than 48 hours after the object expired.

      Important

      Selecting Permanently Delete will not remove incomplete multipart uploads. You must select End and Clean up Incomplete Multipart Uploads as described in the next step to have incomplete multipart uploads removed.

      Verify that the illustration in the EXAMPLE section matches how you want your rule to work.

    3. It is a recommended best practice to select End and Clean up Incomplete Multipart Uploads. For our example, enter 7 for the number of days after the multipart upload initiation date that you want to end and clean up any multipart uploads that have not completed. Then choose Review.

      For more information about multipart uploads, see Multipart Upload Overview in the Amazon Simple Storage Service Developer Guide.

  6. Review and name your rule.

    1. (Optional) You can give your rule a name to identify the rule, if you want. The name must be unique within the bucket. By default, Amazon S3 will generate a unique identifier for the rule.

    2. Choose Edit next to Rule Target or Rule Configuration if you want to make changes.

    3. Choose Create and Activate Rule when all of the settings are as you want them.

  7. If the rule does not contain any errors, it is displayed in the Lifecycle pane.

For information on modifying, disabling, or deleting an existing lifecycle configuration rule, see Maintaining Lifecycle Configuration Rules.