如何将 MFA 与 AWS CLI 结合使用? [英] How to use MFA with AWS CLI?
本文介绍了如何将 MFA 与 AWS CLI 结合使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在使用 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
记录在 此处.这将为您提供一个临时安全令牌.可以在此处找到有关使用临时安全令牌的文档.
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.
这篇关于如何将 MFA 与 AWS CLI 结合使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文