'Copying s3 bucket from on account to another: "The security token included in the request is invalid"

I am trying to copy a set of s3 files from one s3 bucket to another. I'm following the example shown on Amazon Web Services - Copy list of files from S3 bucket to S3 bucket - Stack Overflow.

However, I get an error related to my s3 user account.

aws s3 cp s3://URI_1 s3://URI_2 --profile=admin
Enter MFA code for arn:aws:iam::xxxxx:mfa/evan.gertis: 
fatal error: An error occurred (InvalidClientTokenId) when calling the AssumeRole operation: The security token included in the request is invalid.

Expected: s3 operation performs as expected.

Actual:

fatal error: An error occurred (InvalidClientTokenId) when calling the AssumeRole operation: The security token included in the request is invalid.

I've tried reseting my MFA token, generating a new MFA token, removing MFA entirely, and I've even tried removing myself from the MFA group. I'm able to login with the MFA token from my device. The issue is when I try to run cli commands.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source