1.Attach the policy to Source S3 bucket
{
"Sid": "CrossAccountSyncAccess",
"Effect": "Allow",
"Principal": {"AWS": "destination account"},
"Action" : [ "s3:ListBucket","s3:GetObject"],
"Resource" :[
"arn:aws:s3:::Source-Bucket-Name/*",
"arn:aws:s3:::Source-Bucket-Name"
]
}
- Attach the below iam policy for destination account - EC2 Instance profile role
{
"Sid": "CrossAccountSyncAccess_Source",
"Effect": "Allow",
"Action" : [ "s3:ListBucket","s3:GetObject"],
"Resource" :[
"arn:aws:s3:::Source-Bucket-Name/*",
"arn:aws:s3:::Source-Bucket-Name"
]
},
{
"Sid": "CrossAccountSyncAccess_Destination",
"Effect": "Allow",
"Action" : [ "s3:ListBucket","s3:PutObject","s3:PutObjectAcl"],
"Resource" :[
"arn:aws:s3:::Destination-Bucket-Name/*",
"arn:aws:s3:::Destination-Bucket-Name"
]
}
3. Run the below command
aws s3 sync s3://Source-BucketName s3://Destination-BucketName
Top comments (0)