|« PreviousNext »|
|Did this page help you? Yes | No | Tell us about it...|
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.
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.
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
Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/.
In the Buckets list, click the bucket whose lifecycle configuration you want to configure, and then click Lifecycle.
Click Add rule.
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.
Add a transition and/or expiration action.
A rule can have one transition action and/or one expiration action. You cannot create a rule with more than one of either action.
|Add a transition rule||
Click Add Transition and then do one of the following:
|Add an expiration rule||
Click Add Expiration and then do one of the following:
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.
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.
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
In the Buckets list, click the name of the bucket that contains the rule, and then click Lifecycle.
1. Click the x at the end of the row that describes the rule that you want to delete.