aws configure mfa-login
Для удобства лучше сразу добавить имя генерируемого профиля с помощью
--update-profile , иначе сгенерит автоматически, а также --duration-seconds , максимум на 36 часов и ARN устройства --serial-number, чтобы не вводить отдельно:#
aws --profile=aws-notes-s3-user configure mfa-login --update-profile=mfa-aws-notes-s3-user --duration-seconds=129600 --serial-number=arn:aws:iam::984475386489:mfa/My-iPhoneMFA token code: 969969
Temporary credentials written to profile 'mfa-aws-notes-s3-user'
Credentials will expire at 2025-09-18T19:50:40+00:00
To use these credentials, specify --profile mfa-aws-notes-s3-user when running AWS CLI commands
#
aws --profile mfa-aws-notes-s3-user s3 ls2018-11-18 16:17:32 aws-notes-test
p.s. IAM юзеры зло — используйте SSO (IAM Identity Center).
#aws_cli