You have 2 options:
Pull files
Setup a bucket policy in your source granting read access to the user/role in the destination account.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Example",
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:ListBucket"
],
"Principal": {
"AWS": "arn:aws:iam::DEST_ACCOUNT:user/DestinationAccountUserName"
},
"Resource": [
"arn:aws:s3:::source-bucket",
"arn:aws:s3:::source-bucket/*"
]
}
]
}
Then you can run aws s3 sync s3://source-bucket s3://dest-bucket with a user in the destination account.
Push files
Setup a bucket policy in your destination granting write access to the user/role in the source account.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Example",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:PutObjectAcl"
],
"Principal": {
"AWS": "arn:aws:iam::SOURCE_ACCOUNT:user/SourceAccountUserName"
},
"Resource": [
"arn:aws:s3:::dest-bucket"
],
"Condition": {
"StringEquals": {
"s3:x-amz-acl": "bucket-owner-full-control"
}
}
}
]
}
Then you can run aws s3 sync --acl bucket-owner-full-control s3://source-bucket s3://dest-bucket with a user in the source account. IMPORTANT If you don't set the ACL, the bucket owner in the destination account won't be able to access the objects, that's why we enforce the ACL in the "Condition".
Here's an AWS post about this: https://aws.amazon.com/es/premiumsupport/knowledge-center/cross-account-access-s3/