如何通过AWS CLI使用MFA? [英] How to use MFA with AWS CLI?

查看:180
本文介绍了如何通过AWS CLI使用MFA?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用AWS CLI时如何键入MFA代码?我已经检查了IAM的文档页面 http://docs.aws .amazon.com/cli/latest/reference/iam/index.html .

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.

我已经在我的用户名下启用了MFA设备.

I have the MFA-Devices already enabled under my username.

aws iam list-mfa-devices --user-name X

返回

{
"MFADevices": [
    {
        "UserName": "X", 
        "SerialNumber": "arn:aws:iam::+++:mfa/X", 
        "EnableDate": "2016-01-13T23:15:43Z"
    }
]
}

推荐答案

调用aws sts get-session-token --serial-number <serial> --token-code <code>记录在案的此处找到有关使用临时安全令牌的文档. >.

Call aws sts get-session-token --serial-number <serial> --token-code <code> documented here. This will give you a temporary security token. Documentation on using the temporary security token can be found here.

这篇关于如何通过AWS CLI使用MFA?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆