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

How to set Object Expiration on Amazon S3 Objects?

Using Amazon S3 Object Lifecycle Management , you can define the Object Expiration on Amazon S3 Objects . Once the Lifecycle defined for the S3 Object expires, Amazon S3 will delete such Objects. So, when you want to keep your data on S3 for a limited time only and you want it to be deleted automatically by Amazon S3, you can set Object Expiration. You do not need to worry about deleting such S3 Files manually any more.

Bucket Explorer supports Object Expiration feature as Object Lifecycle.

To set Object Expiration, you need to have Lifecycle configuration added to S3 Bucket. You can add up to 100 rules in the configuration. Each rule consists of Object Prefix and a lifetime for the Objects. You can specify lifetime of S3 object either by number of days since creation date OR by Specify Date, after that Object should be removed.

Note: The Object Expiration time is calculated by Amazon S3 by adding the expiration lifetime to the file creation time and then roundup the result time to the next day midnight GMT.

For example: If a file was created on 09/03/2012 09:40 pm GMT and the expiration time period was specified 4 days, then Amazon S3 would be calculating the expiration date-time of the file as 14/03/2012 00:00 GMT.

You can set Lifecycle Rule for S3 Bucket in one of two ways :-
  1. Set Lifecycle using PUT Bucket Lifecycle REST API - If you are a programmer and want to write your own software code then you can use PUT lifecycle Bucket Rest API.
  2. Set Lifecycle Configuration on S3 Bucket using Bucket Explorer - If you do not want to write single line of code to set Lifecycle confiuration, You can set Lifecycle conguration using Bucket Explorer in few mouse clicks.

Set Lifecycle for Bucket using PUT Bucket Lifecycle

You can set lifecycle configuration on the Bucket, using PUT Bucket Lifecycle request. To authenticate the request, you must be allowed to perform s3:PutLifecycleConfiguration action. Ideally, the owner of the Bucket has this permission and can also grant this permission to others.

Syntax:

To set Lifecycle conguration on your Amazon S3 Bucket, you can request PUT Bucket Lifecycle. For that, you need to specify lifecycle configuration in the request body.


PUT /?lifecycle HTTP/1.1
Host: Bucketname .s3.amazonaws.com
Content-Length: length
Date: date
Authorization: signatureValue
Content-MD5: MD5
Lifecycle configuration in the request body
 

Get Lifecycle Configuration of S3 Bucket using REST API

To get the details about setting lifecycle on your bucket, GET request returns the lifecycle configuration information set on the bucket.

Syntax:

GET /?lifecycle HTTP/1.1
Host: Bucketname .s3.amazonaws.com
Date: currentdate
Authorization: signatureValue
 

Set Lifecycle Configuration on S3 Bucket using Bucket Explorer

How to set Object Expiration on Amazon S3 Objects?

Steps:-

  1. Login to Bucket Explorer with your Amazon credentials.
  2. Select your desired S3 Bucket.
  3. Select "Advanced" -> "Object Lifecycle" -> "Set Object Lifecycle" tool button that exists on Bucket table toolbar.
  4. It will open Object Expiration panel with Prefix and Day two field.
  1. Bucket Explorer checks for lifecycle configuration that exists on your bucket. If any configuration is set, then it will show you the details of that configuration at the time of setting object lifecycle.
  2. You can add up to 100 rule.
  3. Add rule for the desired virtual path for a specific period of time.
  4. When you’re done with adding rules, click on "Apply" button to set Lifecycle configuration on the Bucket.
  5. You can also delete any existing rule from the table.
You can remove Lifecycle Rule for S3 Bucket in one of two ways :-
  1. Remove Lifecycle using Delete Bucket Lifecycle REST API - If you are a programmer and want to write your own software code then you can use Delete lifecycle Bucket Rest API.
  2. Remove Lifecycle Configuration on S3 Bucket using Bucket Explorer - If you do not want to write single line of code to remove Lifecycle confiuration, You can remove Lifecycle conguration using Bucket Explorer in few mouse clicks.

Remove lifecycle configuration from S3 Bucket using DELETE Bucket Lifecycle

Amazon S3 allows you to remove the lifecycle configuration which is set on S3 Bucket. To delete lifecycle configuration from the S3 bucket, you can request DELETE Bucket Lifecycle REST API. To authenticate the request, you must have the permission to perform s3:PutLifecycleConfiguration action. The owner of the bucket has this permission and can grant it to others as well.

Syntax:

To delete lifecycle configuration from the specified Amazon S3 Bucket, you can request DELETE Bucket Lifecycle. For that, you need to use request headers common to all operations.

DELETE /?lifecycle HTTP/1.1
Host: < your bucketname >.s3.amazonaws.com
Date: currentdate
Authorization: signatureValue
 
Delete Object Expiration using Bucket Explorer

While the “DELETE Bucket Lifecycle” API of AWS allows you to remove object expiration on the bucket by writing code, Bucket Explorer lets you do that easily on the UI.

Steps to Remove Object Expiration

  1. Login to Bucket Explorer with your Amazon S3 credentials.
  2. Select your desired S3 Bucket.
  3. Select "Advanced" -> "Object Lifecycle" -> "Remove Object Lifecycle" tool button that exists on bucket table toolbar.
  4. It will alert you before removing Object Expiration from the Bucket.
  5. Click on "yes" to remove Object Expiration.