How To Enable Lifecycle Management In S3 Bucket Using AWS Portal

Introduction 

 
In the previous article, we have learned how to create the S3 bucket and store the objects in bucket.
 
In this article, we will explore the S3 bucket feature, Lifecycle Management.
 
Lifecycle management can be used to optimize storage costs which help to maintain S3 volumes. You can set a lifecycle transition policy to automatically move objects stored in S3 Standard to S3 Standard-IA, S3 One Zone –IA, Glacier.
 
You can also set the lifecycle expiration policy to automatically delete the object after a specified number of days.
 
To set up the lifecycle policy there is no additional cost involved.
 
Let’s see an example, you have stored an object in the S3 standard bucket and after 30 days you will not access this object frequently. So you can move this object to S3 Standard IA after 30 days or you can move this object to S3 One Zone IA if the object is available to one Availability Zone only.
 
Other examples can be like,
  • Moving the object from one bucket type to another bucket type after some period
  • Move the objects to Amazon Glacier after a definite period
  • Expire the objects after a definite period
Amazon S3 supported following the waterfall model for migrating objects between different storage classes as shown below,
 
How To Enable Lifecycle Management In S3 Bucket Using AWS Portal
 
(Source: AWS document)
 
You cannot use a lifecycle policy to move the object from Glacier to Standard or S3 Standard-IA.
 
Lifecycle policy can be applied to the current version and the previous version of objects stored in the S3 bucket. Lifecycle policy can be used independently or in conjunction with versioning.
 
Let’s see the demo on how to enable the lifecycle policy,
 
Step 1
 
Login to AWS console
 
Step 2
 
Go to S3 storage service
 
Step 3
 
Open the S3 bucket. I have used the bucket ‘mys3kkbucket’ which I created in an earlier article
 
Step 4
 
Go to Management > Lifecycle
 
Step 5 
 
Click on Add Lifecycle rule
 
How To Enable Lifecycle Management In S3 Bucket Using AWS Portal
 
Step 6
 
Enter a rule name of your choice. E.g. RuleTest
 
How To Enable Lifecycle Management In S3 Bucket Using AWS Portal
 
Step 7
 
In the Transitions section, there are two options,
  • Current Version – Include new objects
  • Previous Version – Include all objects which already exist in the bucket. Click Next.
How To Enable Lifecycle Management In S3 Bucket Using AWS Portal
 
Step 8 
 
Let’s choose both the options and add transition rules,
 
How To Enable Lifecycle Management In S3 Bucket Using AWS Portal
 
Step 9 
 
Click Next.
 
Step 10
 
In the Expiration section, configure the expiration policy for Current versions and Previous versions to remove the objects from storage class after a specified number of days.
 
How To Enable Lifecycle Management In S3 Bucket Using AWS Portal
 
Step 11 
 
Click Next.
 
Step 12 
 
In the Review section, you can review all the policies rules that you have configured in previous sections.
 
How To Enable Lifecycle Management In S3 Bucket Using AWS Portal
 
Step 12
 
Click Save and lifecycle policy will be created.
 
How To Enable Lifecycle Management In S3 Bucket Using AWS Portal
 

Summary

 
So, this is how we can configure the lifecycle policies for the transition of objects from one storage class to another storage class and remove objects after a definite period.