LoginSignup
3
3

More than 5 years have passed since last update.

Glacier化をしたS3を解凍、ダウンロードするメモ

Last updated at Posted at 2015-09-28

Glacier化したオブジェクトのダウンロードで失敗しないように個人メモ
※個人のメモなのでみる方は注意、実施の際は自己責任で

Glacier化したS3をダウンロードする

目的

S3のLifeCycleによりGlacier化したオブジェクトをダウンロードする

注意事項

Glacierの料金は取り出すファイルのサイズにより決まる
巨大なファイルを大量においている場合は拡張子やファイル名による絞込を行うこと
※結構な金額になる可能性が有ります(というかなった)
コマンド流すときはScreen等を張ってから実行する(オブジェクトの数によってはかなり時間かかる為)

S3の仕様

LifeCycleからGlacierに送ったオブジェクトはGlacierからは見れない
S3ではディレクトリのダウンロードが出来ない
※そもそもディレクトリとかでは無い為
Glacierからの復元は時間がかかる

Glacierから解凍する

例:MyBucketのTargetPathからtxtを含むファイルのみ解凍する(5日間)
# for key in `aws s3api list-objects --bucket MyBucket  --prefix TargetPath --profile ProfileName --output json | jq -r '.Contents[].Key'`| grep txt; do echo $key; aws s3api restore-object --bucket MyBucket --key $key --restore-request '{"Days": 5}' --profile ProfileName;done

ダウンロードを行う

例:MyBucketからtxt形式のみをダウンロード
# aws s3 cp s3://MyBucket . --exclude "*" --include "*.txt" --recursive --profile ProfileName

memo

頻繁にダウンロードをするならGlacier化しない方が良い、または必要のあるものだけ分ける

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3