14
11

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 5 years have passed since last update.

[メモ] 異なる aws アカウント間での、s3バケットのコピー方法手順

Last updated at Posted at 2017-01-25

概要

aws アカウント間をまたぐs3のバケットコピー方法をよく忘れるのでメモしておく。

手順

コピー元バケットポリシー

  • Principal にコピー先のaws アカウント ID を追加
    • 000000000001
      • コピー元 aws アカウント
    • 000000000002
      • コピー先 aws アカウント
{
	"Version": "2012-10-17",
	"Id": "Policy1485173315727",
	"Statement": [
		{
			"Sid": "Stmt1485173309916",
			"Effect": "Allow",
			"Principal": {
				"AWS": [
					"arn:aws:iam::000000000001:root",
					"arn:aws:iam::000000000002:root"
				]
			},
			"Action": "s3:*",
			"Resource": [
				"arn:aws:s3:::org.excample.com",
				"arn:aws:s3:::org.excample.com/*"
			]
		}
	]
}

コピー先EC2

EC2から aws s3 コマンドを実行するので権限的には s3:* の iam roleを割り当てておく

s3 bucket コピー(コピー先アカウントのEC2で)

  • コピーしたいディレクトリを指定している
aws s3 sync --region ap-northeast-1 s3://org.exsample.com/hogehoge s3://new.exsample.com/hogehoge
14
11
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
14
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?