如何使用awscli
获取AWS Account ID
?
我找的是像
这样的东西$ aws <service> <options>
123456789012
关闭,但不是我想要的:$ aws iam get-user
。
答案 0 :(得分:5)
以下命令返回帐号:
aws sts get-caller-identity --query 'Account' --output text
可以找到命令详细信息here
(将命令重新格式化为代码会话)
答案 1 :(得分:3)
需要从aws cli工具获取AWS账户ID吗?你走了:
aws sts get-caller-identity --output text --query 'Account'