Exporting messages to Data Streams
Warning
Yandex IoT Core is no longer available to new users.
Current users can create resources until November 1, 2026. Afterwards, the service will go read-only and cease to operate on December 1, 2026. For more information on the timing and procedure, see Service shutdown.
Note
You can export data to Data Streams only from the */events and */commands topics.
-
In the management console
, select the folder containing the registry. -
Navigate
to IoT Core. -
Select the registry from the list.
-
Navigate to the Export to Data Streams tab.
-
Click Add export.
-
Fill out the fields as follows:
- Name: Export name.
- MQTT topic filter: Specify the topic to export messages from or filter using wildcard characters. If the field is empty, messages from all registry topics and all device topics within the registry will be exported.
- Data stream: Specify the name of the data stream to receive messages from MQTT topics, or create a new one. If you chose to create a new stream, click Refresh to refresh the list of streams once the stream is created.
- Service account: Specify a service account with the
yds.writerrole.
-
Click Add.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also specify a different folder for any command using --folder-name or --folder-id.
If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.
To create an export:
-
Get a list of registries in the folder:
yc iot registry listResult:
+----------------------+-------------------+ | ID | NAME | +----------------------+-------------------+ | arenou2oj4********** | my-registry | +----------------------+-------------------+ -
Create an export:
yc iot registry yds-export add \ --registry-name <registry_name> \ --name <export_name> \ --database <DB_path> \ --stream <stream_name> \ --mqtt-topic-filter <topic> \ --stream-service-account-name <service_account_name>Where:
--registry-name: Registry name.--name: Export name.--database: Location of the database storing the stream data, the second part of the Endpoint field value (following/?database=), e.g.,/ru-central1/r1gra875baom********/g5n22e7ejf**********.--stream: Name of the data stream to receive messages from MQTT topics.--mqtt-topic-filter: Topic to export messages from or filter using wildcard characters. If this parameter is not specified, messages from all registry topics and all device topics within the registry will be exported.--stream-service-account-name: Name of the service account with theyds.writerrole.
Result:
id: are520n46t********** name: export-from-topic registry_id: areqqa5ntm********** database: /ru-central1/b1gia87mbaom********/etnu4r0v1c********** stream: topic-message-stream service_account_id: ajeu9klp40********** created_at: "2023-09-18T09:52:28.840124837Z"
To add an export to Data Streams for a registry, use the RegistryService/AddDataStreamExport gRPC API call.