

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

# 搭配 使用 EventBridge AWS 定價計算工具
<a name="pc-event-bridge"></a>

每當帳單預估中發生特定事件時，主控台內 AWS 定價計算工具 就可以將事件傳送至 Amazon EventBridge。與其他目的地不同，您不需要選取想要傳遞的事件類型。設定 EventBridge 之後，定價計算器事件可以傳送到 EventBridge。您可以使用 EventBridge 規則將事件路由至其他目標。如需設定 EventBridge 的詳細資訊，請參閱[《Amazon EventBridge API 參考》中的 Amazon EventBridge 設定和先決條件](https://docs.aws.amazon.com//eventbridge/latest/userguide/eb-setup.html)。 * EventBridge *

以下列出 AWS 定價計算工具 傳送至 EventBridge 的事件。


****  

| 事件類型 | Description | 
| --- | --- | 
| 已建立 BillEstimate  | 已建立帳單預估。<br />事件傳送至 EventBridge 的帳單預估會發出 ARN、預估名稱和預估 ID。 | 
| BillEstimate 成功 | 帳單預估已完成。這表示您現在可以檢視帳單預估的結果。<br />事件傳送至 EventBridge 的帳單預估會發出 ARN、預估名稱和預估 ID。 | 
| BillEstimate 失敗 | 帳單預估產生失敗。<br />事件傳送至 EventBridge 的帳單預估會發出 ARN、預估名稱和預估 ID。 | 

您也可以使用 AWS 定價計算工具 搭配 EventBridge 傳送事件通知，以寫入在與您的預估相關的事件發生時採取動作的規則。例如，您可以讓其為您傳送通知。如需 Amazon EventBridge 中規則的詳細資訊，請參閱《[Amazon EventBridge API 參考》中的在 Amazon EventBridge 中建立規則](https://docs.aws.amazon.com//eventbridge/latest/userguide/eb-get-started.html#eb-gs-create-rule)。 * EventBridge *

如需有關您可以使用 EventBridge API 與之互動的動作和資料類型的詳細資訊，請參閱[《Amazon EventBridge API 參考](https://docs.aws.amazon.com//eventbridge/latest/APIReference/Welcome.html)》中的 *Amazon EventBridge API 參考*。

## Amazon EventBridge 許可
<a name="pc-event-bridge-permissions"></a>

AWS 定價計算工具 不需要任何額外的許可，即可將事件交付至 Amazon EventBridge。

## 事件訊息結構範例
<a name="pc-event-bridge-examples"></a>

**已建立 BillEstimate **

```
{
    "version": "0",
    "id": "00000000-0000-0000-0000-000000000001",
    "detail-type": "BillEstimate Created",
    "source": "aws.bcm-pricing-calculator",
    "account": "111122223333",
    "time": "2024-09-12T13:47:34Z",
    "region": "us-east-1",
    "resources": ["arn:aws:bcm-pricing-calculator::111122223333:bill-estimate/00000000-0000-0000-0000-000000000000"],
    "detail": {
        "id": "00000000-0000-0000-0000-000000000001",
        "name": "amzn-example-name"
     }
}
```

**BillEstimate 成功**

```
{
    "version": "0",
    "id": "00000000-0000-0000-0000-000000000002",
    "detail-type": "BillEstimate Succeeded",
    "source": "aws.bcm-pricing-calculator",
    "account": "111122223333",
    "time": "2024-09-12T13:47:34Z",
    "region": "us-east-1",
    "resources": ["arn:aws:bcm-pricing-calculator::111122223333:bill-estimate/00000000-0000-0000-0000-000000000002"],
    "detail": {
        "id": "00000000-0000-0000-0000-000000000002",
        "name": "amzn-example-name"
     }
}
```

**BillEstimate 失敗**

```
{
    "version": "0",
    "id": "00000000-0000-0000-0000-000000000003",
    "detail-type": "BillEstimate Failed",
    "source": "aws.bcm-pricing-calculator",
    "account": "111122223333",
    "time": "2024-09-12T13:47:34Z",
    "region": "us-east-1",
    "resources": ["arn:aws:bcm-pricing-calculator::111122223333:bill-estimate/00000000-0000-0000-0000-000000000003"],
    "detail": {
        "id": "00000000-0000-0000-0000-000000000003",
        "name": "amzn-example-name",
        "failureReason": "We can't process this request right now because of an internal error. Try again later."
     }
}
```