檢視變更請求的彙總計數 (命令列) - AWS Systems Manager

AWS Systems ManagerChange Manager 不再開放給新客戶。現有客戶可以繼續正常使用該服務。如需詳細資訊,請參閱AWS Systems ManagerChange Manager可用性變更

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

檢視變更請求的彙總計數 (命令列)

Change Manager 可用性變更

AWS Systems ManagerChange Manager 自 2025 年 11 月 7 日起,不再向新客戶開放。如果您想要使用 Change Manager,請在該日期之前註冊。現有客戶可以繼續正常使用服務。如需詳細資訊,請參閱AWS Systems ManagerChange Manager可用性變更

您可以使用 GetOpsSummary API 操作,在 Change Manager ( AWS Systems Manager中的工具) 中檢視變更請求的彙總計數。此 API 操作可以傳回單一 AWS 帳戶 帳戶或 AWS 區域 多個帳戶和多個區域中的單一 計數。

注意

如果您想要檢視多個 AWS 帳戶 和多個 的變更請求彙總計數 AWS 區域,您必須設定資源資料同步。如需詳細資訊,請參閱建立庫存的資源資料同步

下列程序說明如何使用 AWS Command Line Interface (AWS CLI) (在 Linux、 macOS或 上Windows Server) 來檢視變更請求的彙總計數。

若有檢視變更請求的彙總計數
  1. 如果您尚未安裝並設定 AWS Command Line Interface (AWS CLI),請安裝並設定 。

    如需相關資訊,請參閱安裝或更新最新版本的 AWS CLI

  2. 請執行下列其中一個命令:

    單一帳戶和區域

    此命令會傳回已設定 AWS CLI 工作階段之 AWS 帳戶 和 AWS 區域 的所有變更請求計數。

    Linux & macOS
    aws ssm get-ops-summary \ --filters Key=AWS:OpsItem.OpsItemType,Values="/aws/changerequests",Type=Equal \ --aggregators AggregatorType=count,AttributeName=Status,TypeName=AWS:OpsItem
    Windows
    aws ssm get-ops-summary ^ --filters Key=AWS:OpsItem.OpsItemType,Values="/aws/changerequests",Type=Equal ^ --aggregators AggregatorType=count,AttributeName=Status,TypeName=AWS:OpsItem

    呼叫會傳回相關資訊,如下所示。

    { "Entities": [ { "Data": { "AWS:OpsItem": { "Content": [ { "Count": "38", "Status": "Open" } ] } } } ] }

    多個帳戶及/或區域

    此命令會傳回 資源資料同步中 AWS 區域 指定的 AWS 帳戶 和 的所有變更請求計數。

    Linux & macOS
    aws ssm get-ops-summary \ --sync-name resource_data_sync_name \ --filters Key=AWS:OpsItem.OpsItemType,Values="/aws/changerequests",Type=Equal \ --aggregators AggregatorType=count,AttributeName=Status,TypeName=AWS:OpsItem
    Windows
    aws ssm get-ops-summary ^ --sync-name resource_data_sync_name ^ --filters Key=AWS:OpsItem.OpsItemType,Values="/aws/changerequests",Type=Equal ^ --aggregators AggregatorType=count,AttributeName=Status,TypeName=AWS:OpsItem

    呼叫會傳回相關資訊,如下所示。

    { "Entities": [ { "Data": { "AWS:OpsItem": { "Content": [ { "Count": "43", "Status": "Open" }, { "Count": "2", "Status": "Resolved" } ] } } } ] }

    多個帳戶及特定區域

    此命令會傳回針對資源資料同步中指定的 AWS 帳戶 的所有變更請求的計數。但是,它只會傳回來自命令中指定的區域的資料

    Linux & macOS
    aws ssm get-ops-summary \ --sync-name resource_data_sync_name \ --filters Key=AWS:OpsItem.SourceRegion,Values='Region',Type=Equal Key=AWS:OpsItem.OpsItemType,Values="/aws/changerequests",Type=Equal \ --aggregators AggregatorType=count,AttributeName=Status,TypeName=AWS:OpsItem
    Windows
    aws ssm get-ops-summary ^ --sync-name resource_data_sync_name ^ --filters Key=AWS:OpsItem.SourceRegion,Values='Region',Type=Equal Key=AWS:OpsItem.OpsItemType,Values="/aws/changerequests",Type=Equal ^ --aggregators AggregatorType=count,AttributeName=Status,TypeName=AWS:OpsItem

    多個帳戶和區域 (具有按區域分組的輸出)

    此命令會傳回 資源資料同步中 AWS 區域 指定的 AWS 帳戶 和 的所有變更請求計數。輸出會顯示每個區域的計數資訊。

    Linux & macOS
    aws ssm get-ops-summary \ --sync-name resource_data_sync_name \ --filters Key=AWS:OpsItem.OpsItemType,Values="/aws/changerequests",Type=Equal \ --aggregators '[{"AggregatorType":"count","TypeName":"AWS:OpsItem","AttributeName":"Status","Aggregators":[{"AggregatorType":"count","TypeName":"AWS:OpsItem","AttributeName":"SourceRegion"}]}]'
    Windows
    aws ssm get-ops-summary ^ --sync-name resource_data_sync_name ^ --filters Key=AWS:OpsItem.OpsItemType,Values="/aws/changerequests",Type=Equal ^ --aggregators '[{"AggregatorType":"count","TypeName":"AWS:OpsItem","AttributeName":"Status","Aggregators":[{"AggregatorType":"count","TypeName":"AWS:OpsItem","AttributeName":"SourceRegion"}]}]'

    呼叫會傳回相關資訊,如下所示。

    { "Entities": [ { "Data": { "AWS:OpsItem": { "Content": [ { "Count": "38", "SourceRegion": "us-east-1", "Status": "Open" }, { "Count": "4", "SourceRegion": "us-east-2", "Status": "Open" }, { "Count": "1", "SourceRegion": "us-west-1", "Status": "Open" }, { "Count": "2", "SourceRegion": "us-east-2", "Status": "Resolved" } ] } } } ] }

    多個帳戶和區域 (具有按區域分組的輸出)

    此命令會傳回 資源資料同步中 AWS 區域 指定的 AWS 帳戶 和 的所有變更請求計數。輸出按帳戶和區域分組計數資訊。

    Linux & macOS
    aws ssm get-ops-summary \ --sync-name resource_data_sync_name \ --filters Key=AWS:OpsItem.OpsItemType,Values="/aws/changerequests",Type=Equal \ --aggregators '[{"AggregatorType":"count","TypeName":"AWS:OpsItem","AttributeName":"Status","Aggregators":[{"AggregatorType":"count","TypeName":"AWS:OpsItem","AttributeName":"SourceAccountId","Aggregators":[{"AggregatorType":"count","TypeName":"AWS:OpsItem","AttributeName":"SourceRegion"}]}]}]'
    Windows
    aws ssm get-ops-summary ^ --sync-name resource_data_sync_name ^ --filters Key=AWS:OpsItem.OpsItemType,Values="/aws/changerequests",Type=Equal ^ --aggregators '[{"AggregatorType":"count","TypeName":"AWS:OpsItem","AttributeName":"Status","Aggregators":[{"AggregatorType":"count","TypeName":"AWS:OpsItem","AttributeName":"SourceAccountId","Aggregators":[{"AggregatorType":"count","TypeName":"AWS:OpsItem","AttributeName":"SourceRegion"}]}]}]'

    呼叫會傳回相關資訊,如下所示。

    { "Entities": [ { "Data": { "AWS:OpsItem": { "Content": [ { "Count": "38", "SourceAccountId": "123456789012", "SourceRegion": "us-east-1", "Status": "Open" }, { "Count": "4", "SourceAccountId": "111122223333", "SourceRegion": "us-east-2", "Status": "Open" }, { "Count": "1", "SourceAccountId": "111122223333", "SourceRegion": "us-west-1", "Status": "Open" }, { "Count": "2", "SourceAccountId": "444455556666", "SourceRegion": "us-east-2", "Status": "Resolved" }, { "Count": "1", "SourceAccountId": "222222222222", "SourceRegion": "us-east-1", "Status": "Open" } ] } } } ] }