'How to overcome AccessDenied when using aws s3 sync?
I am getting an Access Denied error for ListObjectsV2 when I run the sync command to sync s3 buckets between accounts. This knowledge doc from aws was made for solving this exact case, except after following it I still get the error.
The error message:
fatal error: An error occurred (AccessDenied) when calling the ListObjectsV2 operation: Access Denied
The identity I'm using when I run the aws cli is a role with AdministratorAccess policy attached in both the source and destination accounts.
The source bucket's policy contains this statement (suggested by the above-mentioned doc):
{
"Sid": "allow infra-team to copy bucket",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<source_account_id>:role/infra-team"
},
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::source-bucket-name"
}
And the destination bucket has that same statement (also per the doc above) except it has <destiantion_account_id> in the principal arn.
So my role has admin permissions in both the source and destination account, and both the source and destination buckets explicitly allow my role to ListBucket. Why am I still getting (AccessDenied) when calling the ListObjectsV2 operation?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
