使用 AWS CLI,我如何输出只有账户名称和账户号码的所有账户的列表?
以下命令输出帐户名称和编号以及其他值,我该如何过滤?
aws organizations list-accounts
答案 0 :(得分:1)
以下命令以表格格式输出帐户名称和帐号 -
aws organizations list-accounts --query 'Accounts[*].[Name, Id]' --output table
输出:
----------------------------------------------------------------------
| ListAccounts |
+----------------------------------------------------+---------------+
| alphabet-finance-dev | 80XX00000001 |
| alphabet-security-prd | 80XX43500061 |
| alphanet-devops-tst | 50XX00000046 |
| ................ | ............ |
+----------------------------------------------------+---------------+
用于文本输出 -
aws organizations list-accounts --query 'Accounts[*].[Name, Id]' --output text
用于 JSON 格式的输出 -
aws organizations list-accounts --query 'Accounts[*].[Name, Id]' --output json
用于 YAML 中的输出 -
aws organizations list-accounts --query 'Accounts[*].[Name, Id]' --output yaml