download free 30 days trial version buy bucket explorer
Documentation  Download  Purchase  Support  FAQs   Forum   ScreenShots & Demos

Amazon S3 - Object Lifecycle Management - Introduction

Amazon S3 supports Object Lifecycle feature which allows you to manage your data in your S3 Bucket. With the help of Object Lifecycle, you can manage your data as you want.

If you have a bucket which has files that you need to delete after some period of time, you have to remember to delete that files to manage your S3 bucket.

If you have some data that you need to access for a period of time and after that you do not need to have but you might need to have it after a longer period of time, you need to keep backup of that file and change the access permission of that objects manually.

For such cases you can define the set of rules that identify the particular objects, timeline, and the action you want to apply on that objects (expiration or archive)

How to perform Lifecycle Configuration Operations?

  • Using S3 REST API

    You can perform Lifecycle configuration operations by using Lifecycle Configuration supported REST API in your application code.

  • Using Bucket Explorer

    You can perform the same Lifecycle configuration operations using Bucket Explorer without the hassle of writing codes.

You can perform the following Lifecycle configuration operations:

Check the link to get more details about about How to Get Set Lifecycle Rules on S3 Bucket using REST API as well as using Bucket Explorer.

  • Add/Remove Object Lifecycle Configuration: You can add or remove Object Lifecycle configuration on your Amazon S3 Bucket using PUT Lifecycle request. Check the link to get more details about about Add/Remove Object Lifecycle Configuration using REST API as well as using Bucket Explorer.
  • How to set Lifecycle rules on S3 Bucket: You can set Lifecycle rules on your Amazon S3 Bucket using PUT Bucket Lifecycle request. On setting lifecycle rule, you can get the details of already set configuration via GET request. You can set any of the following rules:
    1. Object Expiration: You can set Object Expiration on your S3 Bucket.
    2. Object Transition: You can set Object Transition on your S3 Bucket.
  • Restore Amazon Glacier Object: You can restore a single Glacier object as well multiple objects using POST Object restore object. Check the link to get more details about Restore Amazon Glacier Object using REST API as well as using Bucket Explorer.

S3 Object Lifecycle rules are set on the Bucket but these rules are defined on the objects.

Each Rule of Lifecycle configuration is a combination of the following ingredients:

  • Prefix: By object key prefix, you can define the rule for a single or more objects.
  • Action: You can apply specific action or multiple actions for the given prefix objects.

Below can be the following actions for a rule:

  • Transition: When the object reached at the end of its lifetime on the specified date or time period, Amazon S3 changes the Storage Class to GLACIER.
  • Expiration: When the object reached at the end of its lifetime on the specified date or time period, Amazon S3 deletes the objects.
  • Date / Time Period: It specifies the number of days from the creation date of object. This parameter is to specify the point when you want the action to be performed.

Rule Limits: You can have a maximum of 1000 rules in the lifecycle configuration.

Version Bucket: You can not set lifecycle configuration on the bucket that is version enabled or has versioning suspended

Below is a Sample of a Lifecycle Configuration:


<LifecycleConfiguration>
<Rule>
<ID>Example Rule</ID>
<Prefix>Projectdocs</Prefix>>
<Status>Enabled</Status>
<Transition>
<Days;>365<//Days>
<StorageClass;>GLACIER<//StorageClass>
</Transition>
<Expiration>
<Days;>3650<//Days>
</Expiration>
</Rule>
</LifecycleConfiguration>
 

Things you need to know before applying Transition Rule:

  • You cannot get Glacier Storage Class Object at real time because the object is showing in the S3 listing but its storage class is GLACIER. That means it is archived to Amazon Glacier. Now you need to make a request to restore it and create a temporary copy that you can access for a period of time. After that, Amazon S3 deletes the restored temp copy of the S3 objects and finally Objects remains archived in Amazon glacier. Restoration may take 3-5 hours.
  • You can only apply transition rule to Glacier Storage Class.
  • Glacier Objects are only visible at Amazon S3. You can not find it at Amazon Glacier.
  • If the rule contains empty value of the prefix, it applies to all objects of the Bucket.

Things you need to know before applying Expiration Rule:

  • This action deletes the object whether object is in Amazon S3 or archived to Amazon Glacier. After deleting the Object, you can not get it back.
  • If the rule contains empty value of the prefix, it applies to all objects of the Bucket.