

# EventBridge と CloudTrail を使用して中断可能なキャパシティ予約をモニタリングする
<a name="monitor-interruptible-cr"></a>

中断可能なキャパシティ予約は EventBridge 通知と CloudTrail イベントを送信し、キャパシティの変更のモニタリングと対応をサポートします。

**Topics**
+ [EventBridge 通知](#eventbridge-notifications)
+ [CloudTrail のイベント](#cloudtrail-events)

## EventBridge 通知
<a name="eventbridge-notifications"></a>

インスタンス消費者は、2 種類の EventBridge 通知を受け取ります。EventBridge 通知を設定する方法については、「[Amazon EventBridge ルールの作成](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-create-rule.html)」を参照してください。

### インスタンスの中断の警告
<a name="instance-interruption-warning"></a>

中断可能な予約でインスタンスを実行している場合、インスタンスが終了する 2 分前にこの通知を受信します。

```
{
    "version": "0",
    "id": "{{12345678-1234-1234-1234-123456789012}}",
    "detail-type": "EC2 Capacity Reservation Instance Interruption Warning",
    "source": "aws.ec2",
    "account": "[{{instance owner Account ID}}]",
    "time": "[{{Current time in yyyy-mm-ddThh:mm:ssZ}}]",
    "resources": "[{{instance arn}}]",
    "region": "[{{region}}]",
    "detail": {
        "instance-id": "[{{instance-id}}]",
        "instance-action": "{{terminate}}",
        "instance-termination-time": "{{yyyy-mm-ddThh:mm:ssZ}}",
        "azId": "[{{availability-zone-id}}]"
    }
}
```

### 再利用の完了
<a name="reclamation-completion"></a>

ソース予約を所有している場合、キャパシティの再利用が完了すると、この通知を受信します。

```
{
    "version": "0",
    "id": "{{12345678-1234-1234-1234-123456789012}}",
    "detail-type": "EC2 Interruptible Capacity Reservation Allocation Reclamation Completed",
    "source": "aws.ec2",
    "account": "[{{source Capacity Reservation Owner Account ID}}]",
    "time": "[{{Current time in yyyy-mm-ddThh:mm:ssZ}}]",
    "region": "{{us-east-1}}",
    "resources": ["{{source_cr_arn}}"],
    "detail": {
        "sourceCapacityReservationId": "string",
        "instanceType": "string",
        "availabilityZoneId": "string",
        "TotalInstanceCount": "{{current total count in the source}}",
        "ReclaimedInstanceCount": "{{count of instances added to the source}}",
        "targetInstanceCount": "{{number}}"
    }
}
```

## CloudTrail のイベント
<a name="cloudtrail-events"></a>

CloudTrail は、中断可能なキャパシティ予約についてこれらのイベントを記録します。
+ `InterruptibleCapacityReservationCreated` — お客様が中断可能な割り当てを作成する場合
+ `InterruptibleCapacityReservationAllocationUpdated` — お客様が割り当てを変更する場合
+ `InterruptibleCapacityReservationCancelled` — お客様が割り当てをキャンセルする場合
+ `CapacityReservationModified` — 当社が割り当てのソース予約を変更する場合
+ `InterruptibleCapacityReservationInstancesTerminated` — 当社が再利用中にインスタンスを終了する場合