【问题标题】:How do you list only accounts numbers and account names under an AWS organization using AWS CLI如何使用 AWS CLI 仅列出 AWS 组织下的帐号和账户名
【发布时间】:2021-05-22 01:58:38
【问题描述】:

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

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

aws organizations list-accounts

【问题讨论】:

    标签: amazon-web-services aws-cli aws-organizations


    【解决方案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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-08-08
      • 2020-02-14
      • 2019-11-02
      • 1970-01-01
      • 2015-05-25
      • 2021-11-11
      • 1970-01-01
      相关资源
      最近更新 更多