Step 1: Create a policy in the source S3 bucket by clicking on S3 Bucket -> Permissions -> Bucket Policy.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DelegateS3Access",
"Effect": "Allow",
"Principal": {
"AWS": "<%= you destination account id %>"
},
"Action": [
"s3:ListBucket",
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::<%= your source bucket name %>/*",
"arn:aws:s3:::<%= your source bucket name %>"
]
}
]
}
Step 2: Create
Step 2: Create another policy in your destination AWS account by clicking on the following link https://console.aws.amazon.com/iam/home. Select policy on the left sidebar and then click Create Policy. Select
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::<%= your source bucket name %>",
"arn:aws:s3:::<%= your source bucket name %>/*"
]
},
{
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:PutObject",
"s3:PutObjectAcl"
],
"Resource": [
"arn:aws:s3:::<%= your destination bucket name %>",
"arn:aws:s3:::<%= your destination bucket name %>/*"
]
}
]
}
Step 4: Install AWS aws
configure
.
Step 5: Run the command which will copy the bucket from source to destination aws s3 sync s3://sourcebucket s3://destinationcucket