1
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?

More than 1 year has passed since last update.

Wasabiのバケットを複製(バックアップ)する

Posted at

概要

S3互換のストレージサーバーとしてwasabiを使っています。運用中のサービスのバケットを別のバケットに移行したいという出来事があり、以降作業を行いました。wasabiに関する記事が少なかったので、作業手順をまとめます。

大まかな流れ

  1. 新しくバケットを作成する。
  2. aws cliで既存バケットのオブジェクトを新しいバケットに複製する。

前提

  • aws cliがインストールされていること
  • wasabiをすでに運用していること

手順

新しくバケットを作成

  1. 右上のCREATE BUCKETを選択する
    スクリーンショット 2022-12-31 12.34.02.png

  2. 各情報を入力・選択する
    Select Regionはサービス提供を行う地域に近いものを選択する。
    Quick Setupは必要に応じて選択する。これは別のバケットの設定を引き継ぐことができる設定である。
    image.png

  3. 必要な機能をオンにする
    image.png

  4. 確認後CREATE BUCKETを選択
    image.png

    これでバケットの作成ができました。
    あとはポリシーなどを複製元と合わせて終わり。

aws cliで既存バケットのオブジェクトを新しいバケットに複製

実行コマンドのテンプレートは以下です。

s3 sync --region <リージョン名> s3://<複製元バケット名> s3://<複製先バケット名> --endpoint-url=https://s3.<リージョン名>.wasabisys.com --copy-props metadata-directive

例) リージョン:ap-northeast-1、複製元バケット名:origin、複製先バケット名:copy

s3 sync --region ap-northeast-1 s3://origin s3://copy --endpoint-url=https://s3.ap-northeast-1.wasabisys.com --copy-props metadata-directive

説明

  • s3 sync --region <リージョン名> s3://<複製元バケット名> s3://<複製先バケット名>はs3を操作する時の記述と同一です。
  • --endpoint-url=https://s3.ap-northeast-1.wasabisys.comでバケットのエンドポイントがwasabiであることを明示しています。
  • AWS CLI v2の内部でタグに関する機能を使用する場合があり、Wasabiがタグ機能に対応していないため、An error occurred (NoSuchTagSetError) when calling the GetObjectTagging operation: There is no tag set associated with the bucket.というエラーが発生することがあります。それを回避するためにタグ機能を無効にする--copy-props metadata-directiveオプションを付与しています。

参考

1
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
1
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?