

• 2026 年 4 月 30 日之後， AWS Systems Manager CloudWatch Dashboard 將不再可用。客戶可以繼續使用 Amazon CloudWatch 主控台來檢視、建立和管理其 Amazon CloudWatch 儀表板，就像現在一樣。如需詳細資訊，請參閱 [Amazon CloudWatch Dashboard 文件](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Dashboards.html)。

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

# 使用 Amazon EventBridge 監控 Systems Manager
<a name="monitoring-eventbridge-events"></a>

Amazon EventBridge 為無伺服器匯流排服務，可讓您輕鬆將應用程式與來自各種來源的資料互相連線。EventBridge 可從您自己的應用程式、software-as-a-service (SaaS) 應用程式提供即時資料串流， AWS 服務 並將該資料路由至 等目標 AWS Lambda。您可設定路由規則來決定要將資料送往何處，以便建立即時對您所有資料來源做出反應的應用程式架構。EventBridge 可讓您建置鬆耦合和分散式的事件驅動架構。

EventBridge 之前被稱為 Amazon CloudWatch Events。EventBridge 包含的新功能可允許您從 SaaS 合作夥伴和自己的應用程式接收事件。現有 CloudWatch Events 使用者可以在新的 EventBridge 主控台和 CloudWatch Events 主控台中存取其現有的預設匯流排、規則和事件。EventBridge 使用相同的 CloudWatch Events API，因此您的所有現有 CloudWatch Events API 用量保持不變。

EventBridge 可以將數十個 的事件新增至 AWS 服務 您的規則，以及超過 20 個 的目標 AWS 服務。

EventBridge 支援 AWS Systems Manager 事件和 Systems Manager 目標。

**支援的 Systems Manager 事件類型**  
EventBridge 可以偵測到的許多類型的 Systems Manager 事件包括：
+ 手動核准的即時節點存取請求狀態更新。
+ 失敗的即時節點存取請求。
+ 正在關閉維護時段。
+ 成功完成自動化工作流程。Automation 是 AWS Systems Manager中的工具。
+ 受管節點不符合修補程式合規性。
+ 正在更新參數值。

EventBridge 支援下列 AWS Systems Manager 工具的事件：
+ 即時節點存取 (系統會全力發出事件。)
+ 自動化 (盡可能發出事件。)
+ Change Calendar (盡可能發出事件。)
+ 合規
+ 庫存 (盡可能發出事件。)
+ Maintenance Windows (盡可能發出事件。)
+ Parameter Store (盡可能發出事件。)
+ Run Command (盡可能發出事件。)
+ State Manager (盡可能發出事件。)

如需支援的 Systems Manager 事件類型的完整詳細資訊，請參閱 [參考：Systems Manager 的 Amazon EventBridge 事件模式和類型](reference-eventbridge-events.md) 和 [Systems Manager 的 Amazon EventBridge 事件範例](monitoring-systems-manager-event-examples.md)。

**支援的 Systems Manager 目標類型**  
EventBridge 支援下列三個 Systems Manager 工具作為事件規則的目標：
+ 手動執行自動化工作流程
+ 執行 Run Command 命令文件 (盡可能發出事件。)
+ 建立 OpsCenter OpsItem

如需建議使用這些目標的方式，請參閱 [範例方案：Amazon EventBridge 規則的 Systems Manager 目標](monitoring-systems-manager-targets.md)。

如需有關如何開始使用 EventBridge 及設定規則的詳細資訊，請參閱《Amazon EventBridge 使用者指南》**中的 [Amazon EventBridge 入門](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-get-started.html)。如需使用 EventBridge 的完整資訊，請參閱《[Amazon EventBridge 使用者指南](https://docs.aws.amazon.com/eventbridge/latest/userguide/)》**。

**Topics**
+ [

# 為 Systems Manager 事件設定 EventBridge
](monitoring-systems-manager-events.md)
+ [

# Systems Manager 的 Amazon EventBridge 事件範例
](monitoring-systems-manager-event-examples.md)
+ [

# 範例方案：Amazon EventBridge 規則的 Systems Manager 目標
](monitoring-systems-manager-targets.md)

# 為 Systems Manager 事件設定 EventBridge
<a name="monitoring-systems-manager-events"></a>

當支援 AWS Systems Manager 的狀態變更、狀態變更或其他條件發生時，您可以使用 Amazon EventBridge 來執行目標事件。您可以建立規則，在有狀態轉換或有轉移到一個或多個與您相關的狀態時執行。

下列程序提供建立 EventBridge 規則的一般步驟，以便在 Systems Manager 發出指定的事件時進行。如需本使用使用者指南中解決特定案例的程序清單，請參閱本主題末尾的**詳細資訊**。

**注意**  
當您 AWS 帳戶 中的服務發出事件時，一律會前往您帳戶的預設事件匯流排。若要從您帳戶中的 AWS 服務 編寫回應事件的規則，則須將它與預設事件匯流排建立關聯。您可以在尋找來自 事件的自訂事件匯流排上建立規則 AWS 服務，但此規則只會在您透過跨帳戶事件交付從另一個帳戶收到此類事件時啟用。如需詳細資訊，請參閱《Amazon EventBridge 使用者指南**》中的[在 AWS 帳戶之間傳送和接收 Amazon EventBridge 事件](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-cross-account.html)。

**若要為 Systems Manager 事件設定 EventBridge**

1. 前往 [https://console.aws.amazon.com/events/](https://console.aws.amazon.com/events/) 開啟 Amazon EventBridge 主控台。

1. 在導覽窗格中，選擇**規則**。

1. 選擇**建立規則**。

1. 輸入規則的名稱和描述。

   規則不能與相同 AWS 區域 和相同事件匯流排上的另一個規則具有相同的名稱。

1. 針對**事件匯流排**，選擇要與此規則建立關聯的事件匯流排。如果您希望此規則回應來自您自己的相符事件 AWS 帳戶，請選取**預設值**。當您帳戶中 AWS 服務 的 發出事件時，一律會前往您帳戶的預設事件匯流排。

1. 針對**規則類型**，選擇**具有事件模式的規則**。

1. 選擇**下一步**。

1. 在**事件來源**欄位中，選擇 **AWS 事件或 EventBridge 合作夥伴事件**。

1. 在 **Event pattern** (事件模式) 區段中，選擇 **Event pattern form** (事件模式表單)。

1. 在**事件來源**欄位中，選擇 **AWS 服務**。

1. 針對 **AWS service** ( 服務)，請選擇 **Systems Manager**。

1. 針對 **Event type** (事件類型)，執行下列其中一項操作：
   + 選擇 **All Events** (所有事件)。

     如果您選擇 **All Events** (所有事件)，此 Systems Manager 服務發出的所有事件都將符合規則。請注意，此選項可能會導致許多事件目標動作。
   + 選擇要用於此規則的 Systems Manager 事件類型。EventBridge 支援下列 AWS Systems Manager 工具的事件：
     +  自動化
     + Change Calendar
     + 合規
     + Inventory
     + Maintenance Windows
     + Parameter Store
     + Run Command
     + State Manager
**注意**  
對於 EventBridge 不支援的 Systems Manager 動作，您可以透過 CloudTrail 選擇 AWS API 呼叫，進而建立以 API 呼叫為基礎的事件規則 (該規則由 CloudTrail 記錄)。如需範例，請參閱 [使用 Amazon EventBridge (主控台) 監控工作階段活動](session-manager-auditing.md#session-manager-auditing-eventbridge-events)。

1. (選用) 若要使規則更具體，請新增篩選條件值。例如，如果您選擇 **State Manager**，並希望將規則限制為關聯所針對的單一受管執行個體狀態，則針對 **Specific type(s)** (特定類型)，選擇 **EC2 State Manager Instance Association State Change** (EC2 狀態管理員執行個體關聯狀態變更)。

   如需受支援詳細資訊類型的完整詳細資訊，請參閱 [參考：Systems Manager 的 Amazon EventBridge 事件模式和類型](reference-eventbridge-events.md)。

   某些詳細資訊類型具有其他支援的選項，如狀態。可用的選項取決於您選取的工具。

1. 選擇**下一步**。

1. 在**目標類型**欄位中，選擇 **AWS 服務**。

1. 針對**選取目標**，選擇目標，例如 Amazon SNS 主題或 AWS Lambda 函數。當接收到符合規則中定義之事件模式的事件時，就會觸發目標。

1. 對於許多目標類型而言，EventBridge 需要許可才能將事件傳送到目標。在這些情況下，EventBridge 可以建立執行規則所需的 AWS Identity and Access Management (IAM) 角色：
   + 如需自動建立 IAM 角色，請選擇 **為此特定資源建立新角色**。
   + 如需使用您早前建立的 IAM 角色，請選擇 **使用現有角色** 。

1. (選用) 選擇**新增其他目標**，為此規則新增另一個目標。

1. 選擇**下一步**。

1. (選用) 為規則輸入一或多個標籤。如需詳細資訊，請參閱《Amazon EventBridge 使用者指南》**中的 [Amazon EventBridge 標籤](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-tagging.html)。

1. 選擇**下一步**。

1. 檢閱規則的詳細資訊，然後選擇**建立規則**。

**詳細資訊**  
+ [建立使用 Runbook (主控台) 的 EventBridge 事件](running-automations-event-bridge.md#automation-cwe-target-console)
+ [使用輸入轉換器將資料傳遞至 Automation](automation-tutorial-eventbridge-input-transformers.md)
+ [使用 EventBridge 修正合規問題](compliance-fixing.md)
+ [在 EventBridge 中檢視清查刪除操作](inventory-custom.md#delete-custom-inventory-cwe)
+ [設定 EventBridge 規則以建立 OpsItems](OpsCenter-automatically-create-OpsItems-2.md)
+ [為參數及參數政策設定 EventBridge](sysman-paramstore-cwe.md#cwe-parameter-changes)

# Systems Manager 的 Amazon EventBridge 事件範例
<a name="monitoring-systems-manager-event-examples"></a>

以下是支援的 EventBridge 事件的 JSON 格式範例 AWS Systems Manager。

**Topics**
+ [

## AWS Systems Manager 自動化事件
](#SSM-Automation-event-types)
+ [

## AWS Systems Manager事件Change Calendar
](#SSM-Change-Management-event-types)
+ [

## AWS Systems Manager事件Change Manager
](#SSM-Change-Manager-event-types)
+ [

## AWS Systems Manager 合規事件
](#SSM-Configuration-Compliance-event-types)
+ [

## AWS Systems Manager事件Maintenance Windows
](#EC2_maintenance_windows_event_types)
+ [

## AWS Systems Manager事件Parameter Store
](#SSM-Parameter-Store-event-types)
+ [

## AWS Systems Manager事件OpsCenter
](#SSM-OpsCenter-event-types)
+ [

## AWS Systems Manager事件Run Command
](#SSM-Run-Command-event-types)
+ [

## AWS Systems Manager事件State Manager
](#SSM-State-Manager-event-types)

## AWS Systems Manager 自動化事件
<a name="SSM-Automation-event-types"></a>

**自動步驟狀態－變更通知**

```
{
  "version": "0",
  "id": "eeca120b-a321-433e-9635-dab369006a6b",
  "detail-type": "EC2 Automation Step Status-change Notification",
  "source": "aws.ssm",
  "account": "123456789012",
  "time": "2024-11-29T19:43:35Z",
  "region": "us-east-1",
  "resources": ["arn:aws:ssm:us-east-2:123456789012:automation-execution/333ba70b-2333-48db-b17e-a5e69c6f4d1c", 
    "arn:aws:ssm:us-east-2:123456789012:automation-definition/runcommand1:1"],
  "detail": {
    "ExecutionId": "333ba70b-2333-48db-b17e-a5e69c6f4d1c",
    "Definition": "runcommand1",
    "DefinitionVersion": 1.0,
    "Status": "Success",
    "EndTime": "Nov 29, 2024 7:43:25 PM",
    "StartTime": "Nov 29, 2024 7:43:23 PM",
    "Time": 2630.0,
    "StepName": "runFixedCmds",
    "Action": "aws:runCommand"
  }
}
```

**自動執行狀態－變更通知**

```
{
  "version": "0",
  "id": "d290ece9-1088-4383-9df6-cd5b4ac42b99",
  "detail-type": "EC2 Automation Execution Status-change Notification",
  "source": "aws.ssm",
  "account": "123456789012",
  "time": "2024-11-29T19:43:35Z",
  "region": "us-east-2",
  "resources": ["arn:aws:ssm:us-east-2:123456789012:automation-execution/333ba70b-2333-48db-b17e-a5e69c6f4d1c", 
    "arn:aws:ssm:us-east-2:123456789012:automation-definition/runcommand1:1"],
  "detail": {
    "ExecutionId": "333ba70b-2333-48db-b17e-a5e69c6f4d1c",
    "Definition": "runcommand1",
    "DefinitionVersion": 1.0,
    "Status": "Success",
    "StartTime": "Nov 29, 2024 7:43:20 PM",
    "EndTime": "Nov 29, 2024 7:43:26 PM",
    "Time": 5753.0,
    "ExecutedBy": "arn:aws:iam::123456789012:user/userName"
  }
}
```

## AWS Systems Manager事件Change Calendar
<a name="SSM-Change-Management-event-types"></a>

使用本主題中的資訊來規劃和了解 的 EventBridge 事件行為 AWS Systems Manager Change Calendar。

**注意**  
 AWS 帳戶 目前不支援從其他 共用行事曆的狀態變更。

### Change Calendar 與 Amazon EventBridge 整合
<a name="change-calendar-eventbridge-integration"></a>

AWS Systems Manager Change Calendar 與 Amazon EventBridge 整合，以通知您行事曆狀態變更。請注意下列與基礎排程架構相關的行為：

事件計時和可靠性  
+ EventBridge 會盡力提供通知，並具有長達 15 分鐘的排程容錯。
+ 狀態變更事件反映整體行事曆狀態轉換，而不是個別行事曆事件。
+ 當多個行事曆事件同時發生時，EventBridge 只會為每個實際行事曆狀態變更產生一個事件。
+ EventBridge 只會在行事曆的整體狀態轉換 (例如，從 CLOSED 轉換至 OPEN) 時觸發事件，不會對導致狀態變更的個別行事曆事件觸發事件。
+ 不會修改行事曆狀態的諮詢事件不觸發 EventBridge 通知。

事件修改和計時考量  
+ 如果您在排程開始或結束時間的 15 分鐘內修改行事曆事件，EventBridge 可能會產生重複的通知或遺漏通知。
+ 此行為是因為排程系統可能沒有足夠的時間正確更新或取消先前排定的通知。
+ 對於重複性事件，此行為通常只會影響修改後第一次出現的情況。

相鄰和重疊事件  
+ 當行事曆事件排程在彼此的 5 分鐘內時，視實際狀態變更而定，狀態轉換事件可能會也可能不會發生。
+ 即使沒有發生實際狀態變更，以特定順序建立重疊事件可能會產生額外的 EventBridge 事件。
+ 為確保達到可預測的行為，請避免建立或修改接近其執行時間的行事曆事件。

最佳實務  
+ 設計您的 EventBridge 規則和下游自動化，以處理潛在的重複事件。
+ 在自動化工作流程中實作冪等性，以防止重複通知引發的問題。
+ 在建立或修改行事曆事件時，請預留足夠的前置時間 (至少 15 分鐘)。
+ 使用特定行事曆事件模式，全面測試 EventBridge 整合。

**行事曆開啟**

```
{
    "version": "0",
    "id": "47a3f03a-f30d-1011-ac9a-du3bdEXAMPLE",
    "detail-type": "Calendar State Change",
    "source": "aws.ssm",
    "account": "123456789012",
    "time": "2024-09-19T18:00:07Z",
    "region": "us-east-2",
    "resources": [
        "arn:aws:ssm:us-east-2:123456789012:document/MyCalendar"
    ],
    "detail": {
        "state": "OPEN",
        "atTime": "2024-09-19T18:00:07Z",
        "nextTransitionTime": "2024-10-11T18:00:07Z"
    }
}
```

**行事曆關閉**

```
{
    "version": "0",
    "id": "f30df03a-1011-ac9a-47a3-f761eEXAMPLE",
    "detail-type": "Calendar State Change",
    "source": "aws.ssm",
    "account": "123456789012",
    "time": "2024-09-17T21:40:02Z",
    "region": "us-east-2",
    "resources": [
        "arn:aws:ssm:us-east-2:123456789012:document/MyCalendar"
    ],
    "detail": {
        "state": "CLOSED",
        "atTime": "2024-08-17T21:40:00Z",
        "nextTransitionTime": "2024-09-19T18:00:07Z"
    }
}
```

## AWS Systems Manager事件Change Manager
<a name="SSM-Change-Manager-event-types"></a>

**變更請求狀態更新通知 - 範例 1**

```
{
  "version": "0",
  "id": "feab80c1-a8ff-c721-b8b1-96ce70939696",
  "detail-type": "Change Request Status Update",
  "source": "aws.ssm",
  "account": "123456789012",
  "time": "2024-10-24T10:51:52Z",
  "region": "us-east-1",
  "resources": [
    "arn:aws:ssm:us-west-2:123456789012:opsitem/oi-12345abcdef",
    "arn:aws:ssm:us-west-2:123456789012:document/MyRunbook1"
  ],
  "detail": {
    "change-request-id": "d0585556-80f6-4522-8dad-dada6d45b67d",
    "change-request-title": "A change request title",
    "ops-item-id": "oi-12345abcdef",
    "ops-item-created-by": "arn:aws:iam::123456789012:user/JohnDoe",
    "ops-item-created-time": "2024-10-24T10:50:33.180334Z",
    "ops-item-modified-by": "arn:aws:iam::123456789012:user/JohnDoe",
    "ops-item-modified-time": "2024-10-24T10:50:33.180340Z",
    "ops-item-status": "InProgress",
    "change-template-document-name": "MyChangeTemplate",
    "runbook-document-arn": "arn:aws:ssm:us-west-2:123456789012:document/MyRunbook1",
    "runbook-document-version": "1",
    "auto-approve": true,
    "approvers": [
      "arn:aws:iam::123456789012:user/JaneDoe"
    ]
  }
}
```

**變更請求狀態更新通知 - 範例 2**

```
{
  "version": "0",
  "id": "25ce6b03-2e4e-1a2b-2a8f-6c9de8d278d2",
  "detail-type": "Change Request Status Update",
  "source": "aws.ssm",
  "account": "123456789012",
  "time": "2024-10-24T10:51:52Z",
  "region": "us-east-1",
  "resources": [
    "arn:aws:ssm:us-west-2:123456789012:opsitem/oi-abcdef12345",
    "arn:aws:ssm:us-west-2:123456789012:document/MyRunbook1"
  ],
  "detail": {
    "change-request-id": "d0585556-80f6-4522-8dad-dada6d45b67d",
    "change-request-title": "A change request title",
    "ops-item-id": "oi-abcdef12345",
    "ops-item-created-by": "arn:aws:iam::123456789012:user/JohnDoe",
    "ops-item-created-time": "2024-10-24T10:50:33.180334Z",
    "ops-item-modified-by": "arn:aws:iam::123456789012:user/JohnDoe",
    "ops-item-modified-time": "2024-10-24T10:50:33.997163Z",
    "ops-item-status": "Rejected",
    "change-template-document-name": "MyChangeTemplate",
    "runbook-document-arn": "arn:aws:ssm:us-west-2:123456789012:document/MyRunbook1",
    "runbook-document-version": "1",
    "auto-approve": true,
    "approvers": [
      "arn:aws:iam::123456789012:user/JaneDoe"
    ]
  }
}
```

## AWS Systems Manager 合規事件
<a name="SSM-Configuration-Compliance-event-types"></a>

以下是 AWS Systems Manager 合規事件的範例。

**關聯相容**

```
{
  "version": "0",
  "id": "01234567-0123-0123-0123-012345678901",
  "detail-type": "Configuration Compliance State Change",
  "source": "aws.ssm",
  "account": "123456789012",
  "time": "2024-07-17T19:03:26Z",
  "region": "us-east-2",
  "resources": [
    "arn:aws:ssm:us-east-2:123456789012:managed-instance/i-01234567890abcdef"
  ],
  "detail": {
    "last-runtime": "2024-01-01T10:10:10Z",
    "compliance-status": "compliant",
    "resource-type": "managed-instance",
    "resource-id": "i-01234567890abcdef",
    "compliance-type": "Association"
  }
}
```

**關聯不相容**

```
{
  "version": "0",
  "id": "01234567-0123-0123-0123-012345678901",
  "detail-type": "Configuration Compliance State Change",
  "source": "aws.ssm",
  "account": "123456789012",
  "time": "2024-07-17T19:02:31Z",
  "region": "us-east-2",
  "resources": [
    "arn:aws:ssm:us-east-2:123456789012:managed-instance/i-01234567890abcdef"
  ],
  "detail": {
    "last-runtime": "2024-01-01T10:10:10Z",
    "compliance-status": "non_compliant",
    "resource-type": "managed-instance",
    "resource-id": "i-01234567890abcdef",
    "compliance-type": "Association"
  }
}
```

**修補程式相容**

```
{
  "version": "0",
  "id": "01234567-0123-0123-0123-012345678901",
  "detail-type": "Configuration Compliance State Change",
  "source": "aws.123456789012",
  "account": "123456789012",
  "time": "2024-07-17T19:03:26Z",
  "region": "us-east-2",
  "resources": [
    "arn:aws:ssm:us-east-2:123456789012:managed-instance/i-01234567890abcdef"
  ],
  "detail": {
    "resource-type": "managed-instance",
    "resource-id": "i-01234567890abcdef",
    "compliance-status": "compliant",
    "compliance-type": "Patch",
    "patch-baseline-id": "PB789",
    "severity": "critical"
  }
}
```

**修補程式不相容**

```
{
  "version": "0",
  "id": "01234567-0123-0123-0123-012345678901",
  "detail-type": "Configuration Compliance State Change",
  "source": "aws.ssm",
  "account": "123456789012",
  "time": "2024-07-17T19:02:31Z",
  "region": "us-east-2",
  "resources": [
    "arn:aws:ssm:us-east-2:123456789012:managed-instance/i-01234567890abcdef"
  ],
  "detail": {
    "resource-type": "managed-instance",
    "resource-id": "i-01234567890abcdef",
    "compliance-status": "non_compliant",
    "compliance-type": "Patch",
    "patch-baseline-id": "PB789",
    "severity": "critical"
  }
}
```

## AWS Systems Manager事件Maintenance Windows
<a name="EC2_maintenance_windows_event_types"></a>

以下為 Systems Manager Maintenance Windows 的事件範例。

**登錄一個目標**

有效狀態值包括 `REGISTERED` 和 `DEREGISTERED`。

```
{
   "version":"0",
   "id":"01234567-0123-0123-0123-0123456789ab",
   "detail-type":"Maintenance Window Target Registration Notification",
   "source":"aws.ssm",
   "account":"123456789012",
   "time":"2024-11-16T00:58:37Z",
   "region":"us-east-2",
   "resources":[
      "arn:aws:ssm:us-east-2:123456789012:maintenancewindow/mw-0ed7251d3fcf6e0c2",
      "arn:aws:ssm:us-east-2:123456789012:windowtarget/e7265f13-3cc5-4f2f-97a9-7d3ca86c32a6"
   ],
   "detail":{
      "window-target-id":"e7265f13-3cc5-4f2f-97a9-7d3ca86c32a6",
      "window-id":"mw-0ed7251d3fcf6e0c2",
      "status":"REGISTERED"
   }
}
```

**視窗執行類型**

有效狀態值包括下列各項：
+ `CANCELLED`
+ `CANCELLING`
+ `FAILED`
+ `IN_PROGRESS`
+ `PENDING`
+ `SKIPPED_OVERLAPPING`
+ `SUCCESS TIMED_OUT`

```
{
   "version":"0",
   "id":"01234567-0123-0123-0123-0123456789ab",
   "detail-type":"Maintenance Window Execution State-change Notification",
   "source":"aws.ssm",
   "account":"123456789012",
   "time":"2025-06-02T14:52:18Z",
   "region":"us-east-2",
   "resources":[
      "arn:aws:ssm:us-east-2:123456789012:maintenancewindow/mw-0c50858d01EXAMPLE"
   ],
   "detail":{
      "start-time":"2025-06-02T14:48:28.039273Z",
      "end-time":"2025-06-02T14:52:18.083773Z",
      "window-id":"mw-0ed7251d3fcf6e0c2",
      "window-execution-id":"14bea65d-5ccc-462d-a2f3-e99c8EXAMPLE",
      "status":"SUCCESS"
   }
}
```

**任務執行類型**

有效狀態值包括 `IN_PROGRESS`、`SUCCESS`、`FAILED` 和 `TIMED_OUT`。

```
{
   "version":"0",
   "id":"01234567-0123-0123-0123-0123456789ab",
   "detail-type":"Maintenance Window Task Execution State-change Notification",
   "source":"aws.ssm",
   "account":"123456789012",
   "time":"2025-06-02T14:52:18Z",
   "region":"us-east-2",
   "resources":[
      "arn:aws:ssm:us-east-2:123456789012:maintenancewindow/mw-0c50858d01EXAMPLE"
   ],
   "detail":{
      "start-time":"2025-06-02T14:48:28.039273Z",
      "task-execution-id":"6417e808-7f35-4d1a-843f-123456789012",
      "end-time":"2025-06-02T14:52:18.083773Z",
      "window-id":"mw-0ed7251d3fcf6e0c2",
      "window-execution-id":"14bea65d-5ccc-462d-a2f3-e99c8EXAMPLE",
      "status":"SUCCESS"
   }
}
```

**任務目標已處理**

有效狀態值包括 `IN_PROGRESS`、`SUCCESS`、`FAILED` 和 `TIMED_OUT`。

```
{
   "version":"0",
   "id":"01234567-0123-0123-0123-0123456789ab",
   "detail-type":"Maintenance Window Task Target Invocation State-change Notification",
   "source":"aws.ssm",
   "account":"123456789012",
   "time":"2025-06-02T14:52:18Z",
   "region":"us-east-2",
   "resources":[
      "arn:aws:ssm:us-east-2:123456789012:maintenancewindow/mw-123456789012345678"
   ],
   "detail":{
      "start-time":"2025-06-02T14:48:28.039273Z",
      "end-time":"2025-06-02T14:52:18.083773Z",
      "window-id":"mw-0ed7251d3fcf6e0c2",
      "window-execution-id":"791b72e0-f0da-4021-8b35-f95dfEXAMPLE",
      "task-execution-id":"c9b05aba-197f-4d8d-be34-e73fbEXAMPLE",
      "window-target-id":"e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE",
      "status":"SUCCESS",
      "owner-information":"Owner"
   }
}
```

**視窗狀態變更**

有效狀態值包括 `ENABLED` 和 `DISABLED`。

```
{
   "version":"0",
   "id":"01234567-0123-0123-0123-0123456789ab",
   "detail-type":"Maintenance Window State-change Notification",
   "source":"aws.ssm",
   "account":"123456789012",
   "time":"2024-11-16T00:58:37Z",
   "region":"us-east-2",
   "resources":[
      "arn:aws:ssm:us-east-2:123456789012:maintenancewindow/mw-0c50858d01EXAMPLE"
   ],
   "detail":{
      "window-id":"mw-0c50858d01EXAMPLE",
      "status":"DISABLED"
   }
}
```

## AWS Systems Manager事件Parameter Store
<a name="SSM-Parameter-Store-event-types"></a>

以下為 Systems Manager Parameter Store 的事件範例。

**建立參數**

```
{
  "version": "0",
  "id": "6a7e4feb-b491-4cf7-a9f1-bf3703497718",
  "detail-type": "Parameter Store Change",
  "source": "aws.ssm",
  "account": "123456789012",
  "time": "2024-05-22T16:43:48Z",
  "region": "us-east-2",
  "resources": [
    "arn:aws:ssm:us-east-2:123456789012:parameter/MyExampleParameter"
  ],
  "detail": {
    "operation": "Create",
    "name": "MyExampleParameter",
    "type": "String",
    "description": "Sample Parameter"
  }
}
```

**更新參數**

```
{
  "version": "0",
  "id": "9547ef2d-3b7e-4057-b6cb-5fdf09ee7c8f",
  "detail-type": "Parameter Store Change",
  "source": "aws.ssm",
  "account": "123456789012",
  "time": "2024-05-22T16:44:48Z",
  "region": "us-east-2",
  "resources": [
    "arn:aws:ssm:us-east-2:123456789012:parameter/MyExampleParameter"
  ],
  "detail": {
    "operation": "Update",
    "name": "MyExampleParameter",
    "type": "String",
    "description": "Sample Parameter"
  }
}
```

**刪除參數**

```
{
  "version": "0",
  "id": "80e9b391-6a9b-413c-839a-453b528053af",
  "detail-type": "Parameter Store Change",
  "source": "aws.ssm",
  "account": "123456789012",
  "time": "2024-05-22T16:45:48Z",
  "region": "us-east-2",
  "resources": [
    "arn:aws:ssm:us-east-2:123456789012:parameter/MyExampleParameter"
  ],
  "detail": {
    "operation": "Delete",
    "name": "MyExampleParameter",
    "type": "String",
    "description": "Sample Parameter"
  }
}
```

## AWS Systems Manager事件OpsCenter
<a name="SSM-OpsCenter-event-types"></a>

**OpsCenter OpsItem 建立通知**

```
{
  "version": "0",
  "id": "aae66adc-7aac-f0c0-7854-7691e8c079b8",
  "detail-type": "OpsItem Create",
  "source": "aws.ssm",
  "account": "123456789012",
  "time": "2024-10-19T02:48:11Z",
  "region": "us-east-1",
  "resources": [
    "arn:aws:ssm:us-west-2:123456789012:opsitem/oi-123456abcdef"
  ],
  "detail": {
    "created-by": "arn:aws:iam::123456789012:user/JohnDoe",
    "created-time": "2024-10-19T02:46:53.629361Z",
    "source": "aws.ssm",
    "status": "Open",
    "ops-item-id": "oi-123456abcdef",
    "title": "An issue title",
    "ops-item-type": "/aws/issue",
    "description": "A long description may appear here"
  }
}
```

**OpsCenter OpsItem 更新通知**

```
{
  "version": "0",
  "id": "2fb5b168-b725-41dd-a890-29311200089c",
  "detail-type": "OpsItem Update",
  "source": "aws.ssm",
  "account": "123456789012",
  "time": "2024-10-19T02:48:11Z",
  "region": "us-east-1",
  "resources": [
    "arn:aws:ssm:us-west-2:123456789012:opsitem/oi-123456abcdef"
  ],
  "detail": {
    "created-by": "arn:aws:iam::123456789012:user/JohnDoe",
    "created-time": "2024-10-19T02:46:54.049271Z",
    "modified-by": "arn:aws:iam::123456789012:user/JohnDoe",
    "modified-time": "2024-10-19T02:46:54.337354Z",
    "source": "aws.ssm",
    "status": "Open",
    "ops-item-id": "oi-123456abcdef",
    "title": "An issue title",
    "ops-item-type": "/aws/issue",
    "description": "A long description may appear here"
  }
}
```

## AWS Systems Manager事件Run Command
<a name="SSM-Run-Command-event-types"></a>

**Run Command 狀態－變更通知**

```
{
    "version": "0",
    "id": "51c0891d-0e34-45b1-83d6-95db273d1602",
    "detail-type": "EC2 Command Status-change Notification",
    "source": "aws.ssm",
    "account": "123456789012",
    "time": "2024-07-10T21:51:32Z",
    "region": "us-east-2",
    "resources": ["arn:aws:ec2:us-east-2:123456789012:instance/i-02573cafcfEXAMPLE"],
    "detail": {
        "command-id": "e8d3c0e4-71f7-4491-898f-c9b35bee5f3b",
        "document-name": "AWS-RunPowerShellScript",
        "expire-after": "2024-07-14T22:01:30.049Z",
        "parameters": {
            "executionTimeout": ["3600"],
            "commands": ["date"]
        },
        "requested-date-time": "2024-07-10T21:51:30.049Z",
        "status": "Success"
    }
}
```

**Run Command 叫用狀態－變更通知**

```
{
    "version": "0",
    "id": "4780e1b8-f56b-4de5-95f2-95dbEXAMPLE",
    "detail-type": "EC2 Command Invocation Status-change Notification",
    "source": "aws.ssm",
    "account": "123456789012",
    "time": "2024-07-10T21:51:32Z",
    "region": "us-east-2",
    "resources": ["arn:aws:ec2:us-east-2:123456789012:instance/i-02573cafcfEXAMPLE"],
    "detail": {
        "command-id": "e8d3c0e4-71f7-4491-898f-c9b35bee5f3b",
        "document-name": "AWS-RunPowerShellScript",
        "instance-id": "i-02573cafcfEXAMPLE",
        "requested-date-time": "2024-07-10T21:51:30.049Z",
        "status": "Success"
    }
}
```

## AWS Systems Manager事件State Manager
<a name="SSM-State-Manager-event-types"></a>

**State Manager 關聯狀態變更**

```
{
   "version":"0",
   "id":"db839caf-6f6c-40af-9a48-25b2ae2b7774",
   "detail-type":"EC2 State Manager Association State Change",
   "source":"aws.ssm",
   "account":"123456789012",
   "time":"2024-05-16T23:01:10Z",
   "region":"us-east-2",
   "resources":[
      "arn:aws:ssm:us-east-2::document/AWS-RunPowerShellScript"
   ],
   "detail":{
      "association-id":"6e37940a-23ba-4ab0-9b96-5d0a1a05464f",
      "document-name":"AWS-RunPowerShellScript",
      "association-version":"1",
      "document-version":"Optional.empty",
      "targets":"[{\"key\":\"InstanceIds\",\"values\":[\"i-12345678\"]}]",
      "creation-date":"2024-02-13T17:22:54.458Z",
      "last-successful-execution-date":"2024-05-16T23:00:01Z",
      "last-execution-date":"2024-05-16T23:00:01Z",
      "last-updated-date":"2024-02-13T17:22:54.458Z",
      "status":"Success",
      "association-status-aggregated-count":"{\"Success\":1}",
      "schedule-expression":"cron(0 */30 * * * ? *)",
      "association-cwe-version":"1.0"
   }
}
```

**State Manager 執行個體關聯狀態變更**

```
{
   "version":"0",
   "id":"6a7e8feb-b491-4cf7-a9f1-bf3703467718",
   "detail-type":"EC2 State Manager Instance Association State Change",
   "source":"aws.ssm",
   "account":"123456789012",
   "time":"2024-02-23T15:23:48Z",
   "region":"us-east-2",
   "resources":[
      "arn:aws:ec2:us-east-2:123456789012:instance/i-12345678",
      "arn:aws:ssm:us-east-2:123456789012:document/my-custom-document"
   ],
   "detail":{
      "association-id":"34fcb7e0-9a14-4984-9989-0e04e3f60bd8",
      "instance-id":"i-02573cafcfEXAMPLE",
      "document-name":"my-custom-document",
      "document-version":"1",
      "targets":"[{\"key\":\"instanceids\",\"values\":[\"i-02573cafcfEXAMPLE\"]}]",
      "creation-date":"2024-02-23T15:23:48Z",
      "last-successful-execution-date":"2024-02-23T16:23:48Z",
      "last-execution-date":"2024-02-23T16:23:48Z",
      "status":"Success",
      "detailed-status":"",
      "error-code":"testErrorCode",
      "execution-summary":"testExecutionSummary",
      "output-url":"sampleurl",
      "instance-association-cwe-version":"1"
   }
}
```

# 範例方案：Amazon EventBridge 規則的 Systems Manager 目標
<a name="monitoring-systems-manager-targets"></a>

當您指定要在 Amazon EventBridge 規則中叫用的目標時，您可以從超過 20 種目標類型中進行選擇，並在每個規則中新增最多五個目標。

在各種目標中，您可以在發生 EventBridge 事件時，從自動化OpsCenter、 AWS Systems Manager和 中選擇Run Command做為目標動作的工具。

下列是幾個方法範例，您可以使用這些工具作為 EventBridge 規則的目標。

**Automation 範例**  
您可以設定 EventBridge 規則，以在發生下列事件時啟動 Automation 工作流程：
+ 當 Amazon CloudWatch 警示報告受管節點未通過狀態檢查 (`StatusCheckFailed_Instance=1`) 時，執行節點上的 `AWSSupport-ExecuteEC2Rescue` Automation Runbook。
+ 當 `EC2 Instance State-change Notification` 事件發生時，由於新的 Amazon Elastic Compute Cloud (Amazon EC2) 執行個體正在執行，請執行執行個體上的 `AWS-AttachEBSVolume` Automation Runbook。
+ 當建立 Amazon Elastic Block Store (Amazon EBS) 磁碟區且其可用時，執行磁碟區上的 `AWS-CreateSnapshot` Automation Runbook。

**OpsCenter 範例**  
當發生諸如下列事件時，您可以設定 EventBridge 規則來建立新的 OpsItem：
+ 發生 Amazon DynamoDB 的調節事件，或 Amazon EBS 磁碟區效能下降。
+ Amazon EC2 Auto Scaling 群組無法啟動節點，或者 Systems Manager Automation 工作流程失敗。
+ EC2 執行個體將狀態從 `Running` 變更為 `Stopped`。

**Run Command 範例**  
當發生諸如下列事件時，您可以設定 EventBridge 規則來執行 Run Command中的 Systems Manager 命令文件：
+ 當 Auto Scaling 群組即將結束時，Run Command 指令碼可以在其結束之前從節點擷取日誌檔案。
+ 在 Auto Scaling 群組中建立新節點時，Run Command 目標動作可開啟 Web 伺服器角色或在節點上安裝軟體。
+ 當發現受管節點不符合規範時，透過執行 `AWS-RunPatchBaseline` 文件，Run Command 目標動作可更新節點上的修補程式。