LoginSignup
18
21

More than 5 years have passed since last update.

AWS S3で異なるアカウントが所有するバケット間をsyncする

Last updated at Posted at 2014-07-29

アカウントが異なるS3 bucket間を aws s3 sync したい場合の設定例。

前提

  • account: A
    • bucket: AAAA
  • account: B
    • bucket: BBBB

があったとして、AAAA → BBBB に aws s3 sync をしたい。

設定

B が AAAA に対して読み取ることを許可するため、AAAA の bucket policy に以下のような設定をします。
[ACCOUNT-ID-B] は B の aws acccount id (12桁の数字) です。

要するに

  • arn:aws:s3:::AAAA/* に対して s3:GetObject
  • arn:aws:s3:::AAAA に対して s3:ListBucket

を許可ですね。

{
    "Version": "2008-10-17",
    "Id": "Policy1406622286590",
    "Statement": [
        {
            "Sid": "Stmt1406622264456",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::[ACCOUNT-ID-B]:root"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::AAAA/*"
        },
        {
            "Sid": "Stmt1406622282256",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::[ACCOUNT-ID-B]:root"
            },
            "Action": "s3:ListBucket",
            "Resource": "arn:aws:s3:::AAAA"
        }
    ]
}
18
21
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
18
21