Published February 02, 2019 by

AWS S3 LifeCycle rules for moving data from S3 to Glacier

In this tutorial, we learn how do you move your data from Amazon S3 to Glacier? Using Lifecycle Policies. These policies are basically just rules that you can set up to move the data from S3 to Glacier at specific times. Let’s learn how to create a Lifecycle Policy.

What Is Amazon S3 Glacier?
Glacier is an extremely low-cost storage service that provides durable storage with security features for data archiving and backup. With Glacier, customers can store their data cost-effectively for months, years, or even decades. Glacier enables customers to offload the administrative burdens of operating and scaling storage to AWS, so they don't have to worry about capacity planning, hardware provisioning, data replication, hardware failure detection, and recovery, or time-consuming hardware migrations.
What is Amazon S3 Lifecycle Policies?
AWS lifecycle rules are a set of options aimed to manage the data stored within the S3. It allows to move or to delete the objects after the certain number of days by configuring your own lifecycle rules.

Here is a step-by-step guide:
1. Open  your AWS console, click Services in the right upper corner and select S3
2. Select the bucket you want to set up lifecycle rule for and click on it. You will see the following menu on the right to it.
3. Click on Management tab, and then Add lifecycle rule button.

4. Enter a rule name and add the tags/prefixes for your lifecycle rule if necessary.
5. Check the versions of data you want to be transferred with the lifecycle rule, then click on +Add transition button then select Transition to Amazon Glacier after and specify the required amount of days (note that if you set different setting from "0").
6. After that comes the Expiration step. Since the lifecycle is set up for the bucket in S3, you can just skip it and click Next. (This step is setup to Permanently delete files from S3 after given days.)
7. See the Review tab and click Save.
8. Now you can see Lifecycle rule is applied on your selected bucket.
9. You can also Edit Lifecycle rule if requirement changed:
Select rules and click on Edit button.
10. You can also disable Lifecycle rule if requirement changed:
Select rules and click on Actions button and Select  Disable Lifecycle rule.
11. Now try to download any files. you can face problem in downloading a file. The download button is disabled because files are stored in the Glacier, not in S3-standard.

How to Retrieve files or Download Files from Glacier
1. Select a file and click on Restore from Glacier
2. When you restore, you will have to choose how long you want the data to be accessible in S3 and also Retrieval types.
3. After requested you need to wait for few hours and you can download files.