Trigger for Yandex IoT Core that passes messages to the Serverless Containers container
Written by
The trigger for Yandex IoT Core is designed for managing messages exchanged between devices and registries. The trigger is created for topics: it receives copies of messages from them and passes those copies to the Serverless Containers container for processing.
The trigger must be in the same cloud as the device or register as the topic it reads messages from.
You can create a trigger:
- For a standard topic implemented by the service except for the
$monitoring/<device ID>/json
topic. - For a topic with any subtopics and wildcards.
- For an alias topic.
A trigger for Yandex IoT Core needs a service account to invoke the container.
Roles required for the proper operation of a trigger for Yandex IoT Core
- To create a trigger, you need a permission for a service account that runs the trigger executing the operation. This permission is included in the iam.serviceAccounts.user and editor roles and higher.
- To run a trigger, the service account needs the
serverless.containers.invoker
role for the folder with the container to be invoked by the trigger.
Read more about access management.
Trigger for Yandex IoT Core message format
Before the message is copied to a container, the trigger converts it to the following format:
{
"messages": [
{
"event_metadata": {
"event_id": "2153b5d2-c6af-4c69-a28d-74ce965b7613",
"event_type": "yandex.cloud.events.iot.IoTMessage",
"created_at": "2019-09-25T15:51:17.872320525Z"
},
"details": {
"registry_id": "arenou2oj4ct42eq8g3n",
"device_id": "areqjd6un3afc3cefcvm",
"mqtt_topic": "$devices/areqjd6un3afc3cefcvm/events",
"payload": "VGVzdCA0"
}
},
{
"event_metadata": {
"event_id": "2153b5d2-c6af-4c69-a28d-74ce965b7613",
"event_type": "yandex.cloud.events.iot.IoTMessage",
"created_at": "2019-09-25T15:51:17.872320525Z"
},
"details": {
"registry_id": "arenou2oj4ct42eq8g3n",
"device_id": "areqjd6un3afc3cefcvm",
"mqtt_topic": "$devices/areqjd6un3afc3cefcvm/events",
"payload": "VGVzdCA0"
}
}
]
}