You are currently viewing Object Lifecycle Management

Object Lifecycle Management

Object Lifecycle Management

Hello Everyone

Welcome to CloudAffaire and this is Debjeet

In the last blog post, we have discussed Cross Region Replication or CRR. We have also configured CRR between two buckets.

https://cloudaffaire.com/cross-region-replication-crr/

In this blog post, we are going to discuss Object Lifecycle Management in S3. We are also going to create a Lifecycle rule for an S3 bucket.

Object Lifecycle Management:

You can define a set of rule to cost-effectively manage objects throughout their lifecycle. A lifecycle configuration is a set of rules that define actions that Amazon S3 applies to a group of objects.

There are two types of actions that can be performed on objects using Lifecycle

Transition actions:

In transition actions, objects can be moved from one storage class to another storage class. For example, you might choose to transition objects to the STANDARD_IA storage class 30 days after you created them, or archive objects to the GLACIER storage class one year after creating them.

Expiration actions:

In expiration actions, objects can be deleted after certain expiry time. For example, you might choose to delete objects after 30 days.

Actions limitation

  • You can’t transition objects that are less than 128 KB to the STANDARD_IA or ONEZONE_IA storage classes.
  • You can’t transition objects within the first 30 days.
  • You can’t transition from the STANDARD_IA (or ONEZONE_IA) storage class to the STANDARD or REDUCED_REDUNDANCY classes.
  • You can’t transition from the ONEZONE_IA storage class to the STANDARD_IA storage class.
  • You can’t transition from the GLACIER storage class to any other storage class.
  • You can’t transition from any storage class to REDUCED_REDUNDANCY.
  • The transition of objects to the GLACIER storage class is one-way.
  • Lifecycle configuration on MFA-enabled buckets is not supported.
  • Object expiration lifecycle policies do not remove incomplete multipart uploads.

Next, we are going to configure transition and expiration actions on an S3 bucket using Lifecycle rule.

Prerequisite for this demo

One S3 bucket with an object

Create Lifecycle rule:

Step 1: Login to AWS console and click ‘S3’ located under Storage.

Object Lifecycle Management

Step 2: Click on the bucket name.

Object Lifecycle Management

Step 3: Navigate to ‘Lifecycle’ located under ‘Management’ and click ‘Add lifecycle rule’.

Object Lifecycle Management

Step 4: Provide a rule name and click ‘Next’.

Object Lifecycle Management

Note: You can add a filter using prefix or tag to Lifecycle rule to include a subset f objects from your bucket.

For example suppose you have three objects in your bucket namely object1, object2, and log. We have also tagged object1 with key=’name’ and value=’object1’ and object2 with key=’name’ and value=’object2’

Object Lifecycle Management

Now below are the scenario and respective filters in Lifecycle rule

Scenario 1: Apply rule to only object2

Object Lifecycle Management

Scenario 2: Apply rule to object1 and object2

Using prefix

Object Lifecycle Management

Or

Using tag

Object Lifecycle Management

Scenario 3: Apply rule to all objects inside bucket.

Simply make the filter section blank and click ‘Next’

Object Lifecycle Management

In this demo, we are not applying any filter to our Lifecycle rule.

Step 5: Select ‘Current version’ and click ‘Add transition’.

Object Lifecycle Management

Note: You configure lifecycle rules by defining rules to transition objects to the Standard-IA, One Zone-IA, and Amazon Glacier storage classes.

Select the transition storage class from the drop down and provide a schedule in days. Click ‘Next’

Object Lifecycle Management

Step 6: Next, add the expiration action and click ‘Next’.

Object Lifecycle Management

Note: If your bucket has versioning enabled, there are additional considerations that you have to define during Lifecycle rule creation. This demo is for introductory purpose and our bucket don’t have versioning enabled.

Step 7: Review the Lifecycle rule and click ‘Save’.

Object Lifecycle Management

Your new Lifecycle rule has been configured successfully

Object Lifecycle Management

To stop acquiring any cost, remove the Lifecycle rule and delete the bucket once the demo is completed.

Object Lifecycle Management

Object Lifecycle Management

Hope you have enjoyed this article, in the next blog, we will discuss server access logging.

 

Leave a Reply