AWS S3 Glacier Restore

AWS S3 Glacier Restore

This is a very short post on a nice cli I discovered while restoring for S3 Glacier. S3 Glacier is cold storage for S3. It’s a LOT cheaper, but also a little bit of a pain when you need to access them. The pricing is a little hard to understand as well.

Well what I used was AWS S3 Glacier Restore.

It comes with a ton of options and best of all it tells you exactly how much things will cost.

About to restore 18.72GB in 10 files

Restore will cost us:
1) Expedited tier: $0.66
2) Standard tier:  $0.19
3) Bulk tier:      $0.05
Keeping files on S3 will cost: 0.02 per day

The one thing that was non-intuitive was how you download restored objects.

TIP: Make it easier on yourself by restoring to a different prefix instead of restoring it in place.

If you didn’t take the tip, here’s my self memo I made myself. I forget exact details, as this was some time ago, but for the most part I had a hard time using s3api and downloading multiple files at once.

Used this command to restore:

aws-s3-glacier-restore -p s3://random-logs/2023/10/26/ -d 7 -t 300

Use this command to check status, this uses head-object to check the status of the restore:

aws s3api list-objects-v2 --bucket random-logs --prefix=2023/10/21/2023-10-21T00:00:00.000--0rsKnsFW9E1y0kFp0t4.log

Use this command to download restored objects:

# --force-glacier-transfer is required to access restored objects
aws s3 cp s3://random-logs/2023/10/26/2023-10-26T00:00:00.000--0rsKnsFW9E1y0kFp0t4.log . --force-glacier-transfer

Hopefully this helps someone. If you have a really nice way of handling this, please write in the comments.

Joseph Shin

Joseph Shin is a father of two unique boys and a husband to an independent and driven wife. He is a software engineer at heart, leader by necessity, lover of poker, beginner tennis enthusiast and a student of stoicism.