Storing Data in Amazon Glacier

Amazon Web Services released Amazon Glacier, a new service to store data at a low cost (lower than S3), considering the fact that this data becomes not immediately available anymore.
If Glacier’s usage was not so easy to implement where it was first released, it became directly integrated into S3 and therefore very easy to use from the Amazon console.
It consists in setting up rules and transferred will be completed in the background.

How to move data from Amazon S3 to Amazon Glacier

Whatever is the data you want to move to Glacier, it is always set up in the properties of the bucket. Select the bucket and open the “Properties”. You can set up the “Glacier” rules in the “Lifecycle” section as show below.

Click “Add rule” to open the window as shown below, containing the following options:

  • “Enabled”: if checked, the rule will be active and move data to Glacier if this action is set up. If unchecked, the rule will have no effect on the bucket.
  • “Name (Optional)”: Name of the rule.
  • “Apply to Entire Bucket”: if checked, the rule will be applied on all data stored in the bucked. If unchecked, the rule will consider what is filled in the next field “Prefix”.
  • “Prefix”: used to specify which data will be transferred to Glacier.
  • For example, if the field contains “connect_”, all files whose name start with “connect_” will be affected.
    If the field contains “log_files/data_”, all files in the folder “log_files” and with the name starting with “data_” will be affected.

  • “Time Period Format”:
    • “Days from the creation date”: to define which files to transfer based on files creation date.
    • “Date”: to select a fixed date.
  • “Move to Glacier” button: to specify when files should be transferred to Glacier. Specify how many days after file creation or a fixed date.
  • “Expiration” button: to specify when files should be deleted from Glacier. Specify after how many days or at which date files should be permanently deleted. (If you don’t select “expiration” date, files will be permanently stored in Glacier)

For example, the picture above shows a lifecycle rule that moves files to Glacier during the same day of creation in S3, and delete it after 20 days.

When data is transferred to Glacier, it is still displayed at the same location in your buckets, seen via the console. What has changed is the “Storage Class” property of the data, as seen below:

Transferring data to Glacier is not immediate. After creating the rules, data will be scanned in the next hours, and if created rules affect some data, it will be transferred to Glacier.
Any data added to the bucket after creating the rules will also be scanned and transferred if if it matches the rule’s conditions.

How to retrieve data from Glacier? How to move data from Glacier to S3?

The most important thing to know about retrieving data from Glacier to S3 is that it takes about 3 to 5 hours. Glacier is used to store data that doesn’t need to be accessed often and that’s why it takes that much time.

That said, retrieving data is very easy using the console. Right-click on the data and select “Initiate Restore”. The next window asks you to confirm how many days the data becomes temporarily available.