This week I will explain S3 life cycle management. By using S3 lifecycle management, we can decide whether archive our objects or delete them after a period. AWS S3 lifecycle can work with AWS Glacier ( low-cost cloud archive storage service ) . Also we can enable lifecycle rules on version enabled objects in the same way. Today I will give examples about configuring lifecycle management. Before proceeding, I have to give some basic information about glacier. Glacier is an archive service and accessing our objects is not fast as S3. After we move an object to glacier, it takes several hours to retrieve it. After retrieval job completes, you can use your object ( if you want to download it, the duration changes depends on the size of the object ) . Another important information is that you can’t display your object on Glacier console if you moved objects from S3. You can only display them on S3 console. Ok w can start our examples now.
First of all I will create bucket named “wekanban.lifecycle”. Next I will click “Add rule” on Lifecycle tab.
On Step 1, as you see we can apply rule to the whole bucket or we can use a prefix. For example, you have a log folder in your bucket and want to apply the rule to it , you can select the prefix and use “log/”. In my example I will select the whole bucket.
On Step 2, I will select the action. There are three actions here:
– Archive only
– Permanently delete only
– Archive and then permanently delete
In archive only action , objects are moved to Glacier after the object creation date. If you want to move your objects on the same day, you must use 0.
In permanently delete action, objects are deleted and can not be restored. For example, we may want the objects deleted after 10 days.
In archive and then permanently delete action, objects are moved to Glacier after the object creation date and then permanently deleted. For example, you may want to archive your data for 1 month and then delete the older ones. Here you have to configure the 0 as glacier date ( same day move to archive) and 30 for permanently delete date ( delete older than 1 month ).
You can also see an example drawing if you click the “see an example” link near the action select dropdown. After you choose the action you can name and review your rule and finally create and activate it.
If you have enabled versioning on your bucket, you can also add actions on your objects’ previous versions in the same way ( all actions can be used ).
Remember that, you can also modify or delete your rules after you create them.
You can use lifecycle rules and glacier as a backup and archieve solution if you want. If you have any question or comment, please feel free to write and don’t forget to share please.