Search code examples
amazon-web-servicesamazon-s3amazon-glacier

Hierarchical Glacier object retrieval


I would like to restore all objects inside an Amazon S3 bucket, which is now frozen in Glacier. These are my Folders inside the bucket:

$ aws s3 ls s3://cogrehab PRE baseline/ PRE codes/ PRE logs/ PRE tp1/ PRE tp2/ 2014-05-17 20:14:00 27 about.txt

So according to another question here How to restore folders (or entire buckets) to Amazon S3 from Glacier? I proceed as follows:

aws s3 ls s3://cogrehab | awk '{print substr($0, index($0, $4))}' | xargs -I %%% -L 1 aws     s3api restore-object --restore-request Days=90 --bucket cogrehab --key "%%%"`

But I get this error:

Unknown options: baseline/, PRE
xargs: aws: exited with status 255; aborting

Solution

  • I found a blog post on a ruby script that automates the process. here:

    http://www.faun.me/2012/12/16/restoring-archived-files-from-amazon-glacier-using-ruby.html

    In any case you should be aware of penalty fees for s3 retrieval from glacier which could be really high!