0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

残容量の少ないサーバーから、削除前にファイルをバックアップする

0
Posted at

タイトルがほぼ全てです(^^;

ssh hoge@<host> "tar -czf - /home/hoge" | aws s3 cp - s3://<BucketName>/pre/fix/home-hoge.tar.gz

細かく見ていくと、

ssh hoge@<host>           \ # sshで残容量の少ないホストへ接続し、
  "tar -czf - /home/hoge" \ # ホストでtarコマンドを実行してフォルダをバックアップしつつ標準出力へ
  | aws s3 cp -           \ # パイプしてaws-cliにtarの出力を渡し、
      s3://<BucketName>/pre/fix/home-hoge.tar.gz # s3に保存

という流れ。ホストからバケットへのアクセス権限が付与できる状況なら、

tar -czf - /home/hoge" | aws s3 cp - s3://<BucketName>/pre/fix/home-hoge.tar.gz

で、よりカンタンに。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?