In this blog, I will explain about AWS S3 object lifecycle management. Amazon Simple Storage Service (AWS S3) provides an easy procedure to control the lifecycle of your S3 objects. In the below simple steps, we examine how we can simply set up rules to delete or archive old data in S3 using the AWS SDK for. NET.
Lifecycle Rules
Lifecycle configurations are associated with a bucket. An object lifecycle configuration consists of a set of rules; with every rule determines the objects it acts on and the actions to take. Rules determine which objects they work on by specifying a prefix. A rule can catalog an object to Amazon Glacier, delete an object, or both. The activity related with a rule specifies a time restriction on it, getting in touch the objects that are either ancient than a specific number of days or after a specific date. A rule furthermore has a Status, which can be set to Disabled or Enabled. If you have not set this field, the rule will be disabled by default.
AWS S3 Object Lifecycle Management
Create an S3 Bucket
1- Login to your AWS Management console, select services and then select S3 under storage.
2- Click the Create Bucket button.
3- Enter a Bucket name (bucket2244) and then select Region.
4- Uptick Block all public access checkbox.
5- Bucket versioning select enable.
6- Under advanced settings Object Lock section. If you need to lock object then you select the enable option and then click on the Create bucket button.
7- The AWS S3 bucket (bucket2244) has been created successfully.
Upload Files and Folders to an S3 Bucket step by step
This process will explains how to upload files into an S3 bucket.
To upload files to AWS S3 bucket by pointing and clicking
1- Select your S3 bucket (bucket2244) the name of the bucket that you want to upload your files to.
2- Select Upload.
3- In the Upload dialog box, select Add files.
4- Select files to upload, and then select Open.
5- Click next.
6- To set permissions or properties for the files that we are uploading, select next.
7- Select storage class and then click next.
8- Select upload
9- One text file is successfully uploaded to our (bucket2244) bucket.
How to Create a Lifecycle Policy
1- In the Buckets list, select the name of the bucket that you want to create a lifecycle policy for.
2- Select the Management tab, Lifecycle and then select Add lifecycle rule.
3- Lifecycle rule wizard, type a name (lifecycle) for your rule.
The name should be unique within the bucket.
Choose rule scope – Apply to all objects in the bucket. Click Next
Storage class transition
Select the versions for which you need to define transitions, current or previous versions.
Current version: Define transitions that are applied to the current version of the object.
Previous versions: Define transitions that are applied to all previous versions of the object.
4- I have selected Current and Previous version. Click next
5- Current versions of objects
To add a transition
Under For current object versions, select Add transition.
Object creation Days after creation
Transition to Standard-IA after. 30
Transition to One Zone-IA after. 60
Transition to Glacier after. 180
Select the checkbox I acknowledge that this lifecycle ……….. and then select Next.
6- Previous versions of objects
To add a transition
Under For previous versions of objects, select Add transition.
Object becomes a previous version Days after objects become noncurrent
Transition to Standard-IA after. 30
Transition to One Zone-IA after. 60
Transition to Glacier Deep Archive after. 120
Select the checkbox I acknowledge that this lifecycle ……….. And then select Next.
7- Configuring expiration
Select Permanently delete previous versions, and then type the number of days after an object becomes a previous version to permanently delete the object (365 days).
Select Clean up incomplete multipart uploads and type the number of days after the multipart upload initiation that you want to end and clean up incomplete multipart uploads (7 days).
8- Review the settings for your rule. If you need to make changes, select Previous button. Otherwise, click on Save.
9- You can see it on the Lifecycle.
Leave a Reply
You must be logged in to post a comment.