

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

# AWS Ground Station 使用 事件自動化
<a name="monitoring.automating-events"></a>

**注意**  
 本文件全文使用「事件」一詞。CloudWatch Events 和 EventBridge 是相同的基礎服務和 API。您可以使用任一服務建置符合傳入事件並將其路由至目標以進行處理的規則。

 事件可讓您自動化 AWS 服務，並自動回應系統事件，例如應用程式可用性問題或資源變更。來自 AWS 服務的事件會以近乎即時的方式交付。您可編寫簡單的規則，來指示您在意的事件，以及當事件符合規則時所要自動執行的動作。可自動觸發的一些動作包括下列項目：
+ 叫用 AWS Lambda 函數
+ 調用 Amazon EC2 執行命令
+ 將事件轉傳至 Amazon Kinesis Data Streams
+ 啟用 AWS Step Functions 狀態機器
+ 通知 Amazon SNS 主題或 Amazon SQS 佇列

搭配 使用事件的一些範例 AWS Ground Station 包括：
+ 叫用 Lambda 函數，根據事件狀態自動啟動和停止 Amazon EC2 執行個體。
+ 每當聯絡人變更狀態時，發佈至 Amazon SNS 主題。這些主題可設定為在聯絡開始或結束時寄出電子郵件通知。

 如需詳細資訊，請參閱《[Amazon EventBridge Events 使用者指南](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-events.html)》。

## AWS Ground Station 事件類型
<a name="gs-csc-event-types"></a>

**注意**  
 AWS Ground Station 產生的所有事件都有 "aws.groundstation" 做為 "source" 的值。

AWS Ground Station 會發出與狀態變更相關的事件，以支援您自訂自動化的能力。目前， AWS Ground Station 支援聯絡狀態變更事件、資料流程端點群組變更事件和暫時性狀態變更事件。下列各節提供每種類型的詳細資訊。

## 聯絡事件時間表
<a name="monitoring.automating-events.contact-timeline"></a>

AWS Ground Station 當您的聯絡人變更狀態時， 會發出事件。如需這些狀態變更以及狀態本身意義的詳細資訊，請參閱 [了解聯絡生命週期](contacts.lifecycle.md) 。聯絡人中使用的任何資料流程端點群組都有獨立的事件集，也會發出。在相同的時間範圍內，我們也會為您的資料流程端點群組發出事件。當您設定任務描述檔和資料流程端點群組時，您可以設定傳遞前和傳遞後事件的精確時間。

 下圖顯示針對名目聯絡人及其相關聯資料流程端點群組發出的狀態和事件。

 ![Diagram showing statuses and events for a nominal contact and its associated dataflow endpoint group.](http://docs.aws.amazon.com/zh_tw/ground-station/latest/ug/images/monitoring.automating-events.contact-timeline.png) 

 **Ground Station 聯絡狀態變更** 

 如果您想要在即將到來的聯絡變更狀態時執行特定動作，您可以設定規則來自動執行此動作。如果您要接收聯絡狀態變更的相關通知，這種方式就非常有幫助。如果您想要在收到這些事件時變更 ，您可以修改任務設定檔的[contactPrePassDurationSeconds](https://docs.aws.amazon.com/ground-station/latest/APIReference/API_UpdateMissionProfile.html#groundstation-UpdateMissionProfile-request-contactPrePassDurationSeconds) 和 [ contactPostPassDurationSeconds](https://docs.aws.amazon.com/ground-station/latest/APIReference/API_UpdateMissionProfile.html#groundstation-UpdateMissionProfile-request-contactPostPassDurationSeconds)。事件會重送至聯絡排程起始的區域。

 範例事件提供如下。

```
{
    "version": "0",
    "id": "01234567-0123-0123",
    "account": "123456789012",
    "time": "2019-05-30T17:40:30Z",
    "region": "us-west-2",
    "source": "aws.groundstation",
    "resources": [
        "arn:aws:groundstation:us-west-2:123456789012:contact/11111111-1111-1111-1111-111111111111"
    ],
    "detailType": "Ground Station Contact State Change",
    "detail": {
        "contactId": "11111111-1111-1111-1111-111111111111",
        "groundstationId": "Ground Station 1",
        "missionProfileArn": "arn:aws:groundstation:us-west-2:123456789012:mission-profile/11111111-1111-1111-1111-111111111111",
        "satelliteArn": "arn:aws:groundstation::123456789012:satellite/11111111-1111-1111-1111-111111111111",
        "contactStatus": "PASS"
    }
}
```

 的可能值`contactStatus`在 中定義[AWS Ground Station 聯絡狀態](contacts.lifecycle.md#contact-statuses)。

 **Ground Station 資料流程端點群組狀態變更** 

 如果您要在使用資料流程端點群組來接收資料時執行某的動作，您可以設定 規則以自動執行此動作。這樣您就可以在回應資料流程端點群組狀態變更時執行不同的動作。如果您想要在收到這些事件時變更 ，請使用具有不同 [contactPrePassDurationSeconds](https://docs.aws.amazon.com/ground-station/latest/APIReference/API_CreateDataflowEndpointGroup.html#groundstation-CreateDataflowEndpointGroup-request-contactPrePassDurationSeconds) 和 [contactPostPassDurationSeconds](https://docs.aws.amazon.com/ground-station/latest/APIReference/API_CreateDataflowEndpointGroup.html#groundstation-CreateDataflowEndpointGroup-request-contactPostPassDurationSeconds) 的資料流程端點群組。此事件將傳送至資料流程端點群組的區域。

 以下提供範例。

```
{
    "version": "0",
    "id": "01234567-0123-0123",
    "account": "123456789012",
    "time": "2019-05-30T17:40:30Z",
    "region": "us-west-2",
    "source": "aws.groundstation",
    "resources": [
        "arn:aws:groundstation:us-west-2:123456789012:dataflow-endpoint-group/bad957a8-1d60-4c45-a92a-39febd98921d",
        "arn:aws:groundstation:us-west-2:123456789012:contact/98ddd10f-f2bc-479c-bf7d-55644737fb09",
        "arn:aws:groundstation:us-west-2:123456789012:mission-profile/c513c84c-eb40-4473-88a2-d482648c9234"
    ],
    "detailType": "Ground Station Dataflow Endpoint Group State Change",
    "detail": {
        "dataflowEndpointGroupId": "bad957a8-1d60-4c45-a92a-39febd98921d",
        "groundstationId": "Ground Station 1",
        "contactId": "98ddd10f-f2bc-479c-bf7d-55644737fb09",
        "dataflowEndpointGroupArn": "arn:aws:groundstation:us-west-2:680367718957:dataflow-endpoint-group/bad957a8-1d60-4c45-a92a-39febd98921d",
        "missionProfileArn": "arn:aws:groundstation:us-west-2:123456789012:mission-profile/c513c84c-eb40-4473-88a2-d482648c9234",
        "dataflowEndpointGroupState": "PREPASS"
    }
}
```

 `dataflowEndpointGroupState` 可能的狀態包括 `PREPASS`、`PASS`、`POSTPASS` 和 `COMPLETED`。

## Ephemeris 事件
<a name="monitoring.automating-events.ephemeris"></a>

 **Ground Station Ephemeris 狀態變更** 

 如果您想要在暫時性變更狀態時執行動作，您可以設定規則來自動化此動作。這可讓您執行不同的動作，以回應暫時性變化狀態。例如，您可以在 ephemeris 已完成驗證且現在為 時執行 動作`ENABLED`。此事件的通知會在 ephemeris 上傳時傳送至 區域。

 以下提供範例。

```
{
    "id": "7bf73129-1428-4cd3-a780-95db273d1602",
    "detail-type": "Ground Station Ephemeris State Change",
    "source": "aws.groundstation",
    "account": "123456789012",
    "time": "2019-12-03T21:29:54Z",
    "region": "us-west-2",
    "resources": [
        "arn:aws:groundstation::123456789012:satellite/10313191-c9d9-4ecb-a5f2-bc55cab050ec",
        "arn:aws:groundstation::123456789012:ephemeris/111111-cccc-bbbb-a555-bcccca005000"
    ],
    "detail": {
        "ephemerisStatus": "ENABLED",
        "ephemerisId": "111111-cccc-bbbb-a555-bcccca005000",
        "satelliteId": "10313191-c9d9-4ecb-a5f2-bc55cab050ec"
    }
}
```

 的可能狀態`ephemerisStatus`包括 `ENABLED`、`VALIDATING`、`INVALID`、`ERROR`、`DISABLED`、 `EXPIRED`