Skip to content

Instantly share code, notes, and snippets.

@jongacnik
Last active September 30, 2018 22:50
Show Gist options
  • Save jongacnik/98da103ce3edc60340c1f51c95c5c240 to your computer and use it in GitHub Desktop.
Save jongacnik/98da103ce3edc60340c1f51c95c5c240 to your computer and use it in GitHub Desktop.

AWS S3 Transfer

When syncing an S3 bucket within the same AWS, you still need to attach some policies. I followed these instructions, but in case they go offline. You need the following:

Policy on source bucket

{
"Id": "Policy1357935677554",
"Statement": [
    {
        "Sid": "Stmt1357935647218",
        "Action": [
            "s3:ListBucket"
        ],
        "Effect": "Allow",
        "Resource": "arn:aws:s3:::SourceBucket",
        "Principal": {"AWS": "arn:aws:iam::XXXXXXXXXXXX:user/src–iam-user"}
    },
    {
        "Sid": "Stmt1357935676138",
        "Action": ["s3:GetObject"],
        "Effect": "Allow",
        "Resource": "arn:aws:s3::: SourceBucket/*",
        "Principal": {"AWS": "arn:aws:iam::XXXXXXXXXXXX:user/src–iam-user"}
   }
]
}

Policy on new bucket

{
"Id": "Policy1357935677554",
"Statement": [
    {
        "Sid": "Stmt1357935647218",
        "Action": [
            "s3:ListBucket"
        ],
        "Effect": "Allow",
        "Resource": "arn:aws:s3::: DestinationBucket",
        "Principal": {"AWS": "arn:aws:iam::XXXXXXXXXXXX:user/src–iam-user"}
    },
    {
        "Sid": "Stmt1357935676138",
        "Action": ["s3:PutObject"],
        "Effect": "Allow",
        "Resource": "arn:aws:s3::: DestinationBucket/*",
        "Principal": {"AWS": "arn:aws:iam::XXXXXXXXXXXX:user/src–iam-user"}
   }
]
}

Replace SourceBucket with your source bucket name, DestinationBucket with your destination bucket name, and arn:aws:iam::XXXXXXXXXXXX:user/src–iam-user with your IAM user arn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment