How to use MFA with AWS CLI?

前端 未结 13 1286
太阳男子
太阳男子 2020-12-05 00:05

How do I type in the MFA code when using the AWS CLI? I have checked the documentation page of IAM http://docs.aws.amazon.com/cli/latest/reference/iam/index.html.

I

13条回答
  •  [愿得一人]
    2020-12-05 00:45

    I wrote a small bash script to get over this annoying problem. You can find it here: https://gist.github.com/geekgunda/db4c9c8d850c08a48d1d60f119628032

    Assumptions:

    1. Your original AWS Creds should be stored at ~/.aws/credentials
    2. You've corrected ARN for MFA device (search for FIXME)
    3. You've given correct MFA Code as cli argument
    4. You have jq installed. Ref: https://stedolan.github.io/jq/

提交回复
热议问题