Amazon Simple Storage Service
Console User Guide (API Version 2006-03-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Managing Lifecycle Configuration

This section explains how to manage lifecycle configuration rules for a bucket: adding, viewing, deleting, and disabling rules. Each rule identifies objects and actions that you want Amazon S3 to perform when the objects reach a specific date or a time interval since their creation. For more information about lifecycle configuration, go to Object Lifecycle Management in the Amazon Simple Storage Service Developer Guide.

You can use lifecycle configuration rules to archive or delete objects after a specified period of time or on a specified date. A transition action archives an object, and an expiration action deletes the object.

Archiving Objects

You use the transition action in the lifecycle configuration rule to archive objects. An archived object is not directly accessible unless you restore a temporary copy. Additionally, you cannot use a lifecycle configuration rule to change the storage class of the archived object from Glacier to Standard or RRS.

Amazon S3 objects that have been transitioned to the Glacier storage class are visible and available only through the Amazon S3 console or the API, not through the Amazon Glacier console or the API. For more information about archiving objects, see Before You Decide to Archive Objects in the Amazon Simple Storage Service Developer Guide.

Deleting Objects

You use the expiration action in the lifecycle configuration rule to delete objects. You might have objects in Amazon S3 or archived to Amazon Glacier. No matter where these objects are, Amazon S3 will delete them, and you will no longer be able to access them. For more information about scheduling object deletion, see Before You Decide to Expire Objects in the Amazon Simple Storage Service Developer Guide.

To add a lifecycle configuration rule

  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, click the bucket whose lifecycle configuration you want to configure, and then click Lifecycle.

  3. Click Add rule.

  4. In the Lifecycle Rule dialog box, specify the following attributes:

    • Enabled – If selected, indicates that the rule is enabled. If cleared, Amazon S3 will not apply the rule to associated objects.

    • Name – (Optional) Identifies the rule. The name must be unique within the bucket. By default, Amazon S3 will generate a unique identifier for the rule.

    • Apply to Entire Bucket – If selected, the rule applies to all objects in the bucket, and the Prefix attribute is ignored.

    • Prefix – Specifies the subset of objects to which the rule applies. For example, "logs/" would apply to all objects in the "logs" folder. For information about how to specify a prefix value, and the upper and lower bounds of expiration time, go to Object Expiration in the Amazon Simple Storage Service Developer Guide.

    • Time Period Format – Specifies whether the rule will be applied a specified number of days from the date the object was created or on a specified date.

    1. Add a transition and/or expiration action.

      Note

      A rule can have one transition action and/or one expiration action. You cannot create a rule with more than one of either action.

      To...Do this...
      Add a transition rule

      Click Add Transition and then do one of the following:

      1. If you specified Days from creation date as the Time Period Format for the rule, under Time Period type the number of days after the object’s creation date when it will be archived.

      2. If you specified Date as the time period format for the rule, under Time Period, type the Date that the object will be archived using the format "mm/dd/yyyy", or click the date on the calendar that appears.

      Add an expiration rule

      Click Add Expiration and then do one of the following:

      1. If you specified Days from creation date as the time period format for the rule, under Time Period  type the number of days after the object’s creation date when it will be archived.

      2. If you specified Date as the time period format for the rule, type the Date that the object will be archived using the format "mm/dd/yyyy", or click the date on the calendar that appears.

    The following example shows a rule that immediately transitions objects with the prefix "logs/" to the Amazon Glacier storage class and then expires the objects after 365 days.

  5. When all of the settings are as you want them, click Save.

    When a confirmation dialog appears, click OK.

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

    Note

    If there is an issue with a rule, an error message is displayed with information about the issue. For example, if the bucket is versioning-enabled or an expiration date is not specified when you create a rule, an error message is displayed. Similarly, if you have multiple rules, Amazon S3 determines if the rule being added will conflict with an existing rule. In that case, the rule cannot be saved.

    In some cases, Amazon S3 will display an informational message. For example, if you do not specify a prefix, then an informational message indicates that for a blank prefix, the expiration policy applies to all objects in the bucket. In that case, the rule can be saved.

Rules that apply to an object are displayed with the object properties.

To view an object's expiration rule

  • In the Object and Folders list, click the object whose properties you want to view.

    Among the object properties, the Expiry Date and Lifecycle Rule indicate which object expiration rule applies to the object. If no object expiration rule applies to the object, the Expiry Date field displays None, and the Lifecycle Rule field displays N/A.

    The following example shows the properties for an object in which an expiration rule named "Trans-Logs-And-Expr" applies to the object.

    The following examples shows the properties for an object in which no expiration rule applies to the object.

To delete a lifecycle configuration rule

  1. In the Buckets list, click the name of the bucket that contains the rule, and then click Lifecycle.

  2. 1. Click the x at the end of the row that describes the rule that you want to delete.

  3. Click Save.

To disable a lifecycle configuration rule

  1. In the Buckets list, click the name of the bucket that contains the rule, and then click Lifecycle.

  2. Clear the Enabled check box for the rule.

  3. Click Save.

    The rule is not deleted; you can enable it again later if you want.