S3Sync: Source bucket: prod_bucket_A to Destination bucket: prod_bucket_B failed fatal error:S3SYNC An error occurred (AccessDenied) when calling the ListObjectsV2 operation: Access Denied

S3Sync: Source bucket: prod_bucket_A to Destination bucket: prod_bucket_B failed fatal error:S3SYNC An error occurred (AccessDenied) when calling the ListObjectsV2 operation: Access Denied

Issue:
When trying to synchronize two buckets in CPM I get the following error message.
S3Sync: Source bucket: Prod_bucket to Destination bucket: Dev_bucket failed fatal error: S3SYNC An error occurred (AccessDenied) when calling the ListObjectsV2 operation: Access Denied 

Solution:
This error is caused by an issue with the S3:ListBuckets permission. You should update the role/user permissions using the latest CPM JSON Permisison files located at this link.
  1. N2WS json permission files: https://support.n2ws.com/portal/en/kb/articles/what-are-the-required-minimal-aws-permissions-roles-for-cpm-operation
  2. How to update the role: https://support.n2ws.com/portal/en/kb/articles/how-to-update-the
For cross account, Cross-account S3 sync operation is done with the account of the policy (not the account of the destination S3 bucket) and requires cross-account access permissions to objects that are stored in destination S3 bucket.

In addition, Access denied error can also be caused by bucket policy issues, this AWS Article explains the error and how to correct the permissions on the bucket: https://aws.amazon.com/premiumsupport/knowledge-center/s3-access-denied-listobjects-sync/

Troubleshoot:
From the account running the sync, you can launch small AWS Linux EC2 with relevant role and run below command, if it fails either the role is missing something or the bucket policy is missing something
aws s3api list-objects-v2 --bucket my-s3-sync-myotheraccount