

지원 종료 알림: 2026년 5월 20일에 AWS 에 대한 지원이 종료됩니다 AWS IoT Events. 2026년 5월 20일 이후에는 AWS IoT Events 콘솔 또는 AWS IoT Events 리소스에 더 이상 액세스할 수 없습니다. 자세한 내용은 [AWS IoT Events 지원 종료를 참조하세요](https://docs.aws.amazon.com/iotevents/latest/developerguide/iotevents-end-of-support.html).

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# 에서 MQTT 메시지 수집 AWS IoT Events
<a name="iotevents-commented-example-ingest-mqtt"></a>

센서 컴퓨팅 리소스가 `"BatchPutMessage"` API를 사용할 수 없지만 경량 MQTT 클라이언트를 사용하여 AWS IoT Core 메시지 브로커로 데이터를 전송할 수 있는 경우 AWS IoT Core 주제 규칙을 생성하여 메시지 데이터를 AWS IoT Events 입력으로 리디렉션할 수 있습니다. 다음은 MQTT AWS IoT Events 주제의 `"areaId"` 및 `"sensorId"` 입력 필드와 메시지 페이로드 `"sensorData.temperature"` 필드의 `"temp"` 필드를 가져와이 데이터를 로 수집하는 주제 규칙의 정의입니다 AWS IoT Events `"temperatureInput"`.

CLI 명령:

```
aws iot create-topic-rule --cli-input-json file://temperatureTopicRule.json
```

파일: `seedSetDesiredTemp.json`

```
{
  "ruleName": "temperatureTopicRule",
  "topicRulePayload": {
    "sql": "SELECT topic(3) as areaId, topic(4) as sensorId, temp as sensorData.temperature FROM 'update/temperature/#'",
    "description": "Ingest temperature sensor messages into IoT Events",
    "actions": [
      {
        "iotEvents": {
          "inputName": "temperatureInput",
          "roleArn": "arn:aws:iam::123456789012:role/service-role/anotheRole" 
        }
      }
    ],
    "ruleDisabled": false,
    "awsIotSqlVersion": "2016-03-23"
  }
}
```

응답: [없음]

센서가 다음 페이로드와 함께 주제 `"update/temperature/Area51/03"`에 대한 메시지를 보내는 경우.

```
{ "temp": 24.5 }
```

이렇게 하면 다음 `"BatchPutMessage"` API 호출이 이루어진 AWS IoT Events 것처럼 데이터가에 수집됩니다.

```
aws iotevents-data batch-put-message --cli-input-json file://spoofExample.json --cli-binary-format raw-in-base64-out
```

파일: `spoofExample.json`

```
{
  "messages": [
    {
      "messageId": "54321",
      "inputName": "temperatureInput",
      "payload": "{\"sensorId\": \"03\", \"areaId\": \"Area51\", \"sensorData\": {\"temperature\": 24.5} }"
    }
  ]
}
```