1

使用 AWS CLI,我如何输出仅包含账户名称和帐号的所有账户的列表?

下面的命令输出帐户名称和号码以及其他值,我该如何过滤?

aws organizations list-accounts
4

1 回答 1

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
于 2021-05-22T01:58:38.147 回答