Contents
S3のレプリケーション機能を試す
レプリカとは複製です。
つまりレプリケーションとは複製を作成する機能になります。
今回は東京リージョンのS3のバケットにファイルを保存し、自動的にシドニーリージョンのS3のバケットにそのファイルが複製されることを確認します。
バケットを作成する

まずバケットを2つ作成します。
1つは複製元のバケットを東京リージョンに、もう一つは複製先のバケットをシドニーに作成します。

レプリケーション元(複製元)のバケットを作成します。
バケット名:belpia-bucket-from
リージョン:東京

レプリケーション元(複製元)のバケットを作成します。
バケット名:belpia-bucket-to
リージョン:シドニー

レプリケーション用のバケットが作成されました。
レプリケーションの設定をする
下記の通りレプリケーションの設定はレプリケーション元となるS3バケットで設定を行います。

バケットのプロパティタブの中でバージョニングをクリックします。

バージョニングの有効化を選択して保存します。

管理タブのレプリケーションでルールの追加をクリックします。

今回はバケット内の全てのファイルをレプリケーション対象にします。
タグで一部のファイルのみをレプリケーション対象にすることもできます。

レプリケーション先(複製先)のバケットにbelpia-bucket-toを指定します。
シドニーのバケットをレプリケーション先にします。
レプリケーション先のバケットのバージョニングを有効化します。

このまま次へを選択します。

新しいロールを作成します。
ここではbelpia-replication-testとします。

これで下記の内容でレプリケーションの設定がされます。
送信元:belpia-bucket-from(東京)
送信先:belpia-bucket-to(シドニー)
ルール:belpia-replication-test
※自分が分かりやすい名前なら何でも大丈夫です。
但しバケット名は他の人と被らない様にする必要があります。

図のようなレプリケーション設定ができました。
IAMロール名は自動的に作成されています。
レプリケーションの動作を試す

レプリケーション元のバケットが空の状態です。

レプリケーション先のバケットも空の状態です。

レプリケーションの機能を確認するためのファイルを作成します。

レプリケーション元となる東京リージョンのバケットのbelpia-bucket-fromにファイルをアップロードします。

図の様にファイルが保存されていることを確認します。

レプリケーション先のバケットである、シドニーのbelpia-bucket-toにも同じファイルが存在することを確認します。

東京リージョンのバケットであるbelpia-bucket-fromに入っているファイルを削除します。

当然東京リージョンのバケットであるbelpia-bucket-fromからそのファイルは削除されています。

シドニーリージョンであるbelpia-bucket-toはファイルが削除されることなく残っています。
今回のおさらい
S3のレプリケーション機能を使って、ファイルを複製し意図しないデータ損失を防ぐことができます。
そのためにはS3のバージョニング機能を有効化する必要があります。