In this blog,we are going to learn how to apply life cycle policy in S3.
To do this, first we have to create a bucket. As shown in figure 1, select create bucket.
Then give a unique name for your bucket. Note that the name should be unique globally. Then select create bucket shown at the end of the page.
Now you can see that the bucket has been created. Click on the bucket.
Now we are going to upload a file to our bucket. Select the upload icon at the top as shown in figure 4. Then browse your documents and select the file that should be uploaded. In here, we uploaded test file.txt from our pc.
Next, click the Management tab at the top and select add lifecycle rule icon.
Then we will be prompted in to the Lifecycle rule window. Give a name to your rule and choose the apply to all objects in the bucket. Then click next.
In the transition tab, it will ask what are the versions that are needed to be transited. In here, let’s give both the current and previous versions. In this way both the current and previous versions of data will be transited.
Then for the current version, add a transition: Transition to Standard AI after and give 30 days. This means the current objects will be moved to standard AI after 30 days. Then, let’s add another transition: Transition to Glacier after and give 60 days. This means the current objects will move to Glacier in 60 days.
Glacier is an archiving tool in S3, it will lock your data for 3-5 years. Between that period, you can’t take the data out from Glacier. Then tick the acknowledgement.
Do the same procedure with the previous version. Then click next.
In the expiration tab, you can specify the number of days which the files should be expired after creation. Since we are considering both the current and previous versions, tick current and previous versions. Then, specify the days for each versions as shown in the figure 8.
There is an option called to clean up incomplete multipart uploads. Multipart uploads mean, since some files are large, they are uploaded partially. By ticking this option, incomplete multipart files will be deleted. The number of days can also be specified. In here, it’s given as 7. Then tick the acknowledgment. Finally, click next.
Then we can review our lifecycle rule. Just like that we can create a lifecycle policy in S3.