LoginSignup
5
5

More than 5 years have passed since last update.

AWS コマンドラインインターフェイスを利用してS3にバックアップしたファイルを取得する

Posted at

AWS コマンドラインインターフェイス:
http://aws.amazon.com/jp/cli/

aws s3 sync:
http://docs.aws.amazon.com/cli/latest/reference/s3/sync.html

まずはAWSの必要な設定を設定を行う。詳細はググってください。

export AWS_ACCESS_KEY_ID={AWS_ACCESS_KEY_ID}
export AWS_SECRET_ACCESS_KEY={AWS_SECRET_ACCESS_KEY}
export AWS_DEFAULT_REGION=ap-northeast-1

仮にbucket[log]に下記のオブジェクトをS3にアップロードしていたとする。

access-log/2013/10/25/web1.access_log.20131025
access-log/2013/10/25/web2.access_log.20131025
access-log/2013/10/26/web1.access_log.20131026
access-log/2013/10/26/web2.access_log.20131026

ログ調査のために2013/10/25分のログファイルだけ取得したければ、下記のコマンドを実行すると指定日付のログがカレントディレクトリにダウンロードされる。

aws s3 sync s3://log/access-log/2013/10/25 .

パスを逆にするとローカルファイルをアップロードもできるので、バックアップも簡単です。

5
5
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
5
5