0
votes

We are building an IoT solution where we need bi-directional communication between Device and Cloud.

Azure IoT Hub seems to be a perfect fit.

However, the pricing is steep for a reasonable amount of outgoing messages/day for our needs (when compared to Event Hub).

So I was thinking of an hybrid solution where Azure IoT Hub would be used only for Cloud-to-Device messages, and Event Hub would be used for Device-To-Cloud messages.

Would this be a viable solution ?

2
One of the major differences is the per-device authentication IoT Hub offers. You would need this for the Cloud to Device communication for sure as you have already noted. What are the volumes you are looking at (# devices, # D2C messages per device, frequency of messages)?Olivier Bloch
A dozen devices sending each second. Iot Hub: ~180$/month, Event Hub: ~15$/month. So Iot Hub is more than ten times the price of Event Hub.Guillaume Morin

2 Answers

1
votes

An event hub is already used under the hood but sure, it can be done. However, there are subtle differences according to the docs.

The main differences when it comes to Device to Cloud messaging:

IoT hub

protocols: Supports MQTT, MQTT over WebSockets, AMQP, AMQP over WebSockets, and HTTPS. Additionally, IoT Hub works with the Azure IoT protocol gateway, a customizable protocol gateway implementation to support custom protocols.

Device SDKs: Provides device SDKs for a large variety of platforms and languages, in addition to direct MQTT, AMQP, and HTTPS APIs.

Event Hub

protocols: Supports AMQP, AMQP over WebSockets, and HTTPS.

Device SDKs: Is supported on .NET, Java, and C, in addition to AMQP and HTTPS send interfaces.

Then there is the differences in security mechanisms and message routing (see the docs) so if using the Event Hub needs your requirements i'd say give it a go.

Summary (from docs)

In summary, even if the only use case is device-to-cloud telemetry ingress, IoT Hub provides a service that is designed for IoT device connectivity. It continues to expand the value propositions for these scenarios with IoT-specific features. Event Hubs is designed for event ingress at a massive scale, both in the context of inter-datacenter and intra-datacenter scenarios.

It is not uncommon to use both IoT Hub and Event Hubs in the same solution. IoT Hub handles the device-to-cloud communication, and Event Hubs handles later-stage event ingress into real-time processing engines.

0
votes

Well, it seems like the question was asked long ago, but I hope that this will be of some help to someone in the future.

I believe that choosing Event Hub for Device messages will result in losing the following capabilities that IoT Hub present:

  • Per-device Identity: Every IoT hub has an identity registry that stores information about the devices and modules permitted to connect to the IoT hub. Before a device or module can connect to an IoT hub, there must be an entry for that device or module in the IoT hub's identity registry. A device or module must also authenticate with the IoT hub based on credentials stored in the identity registry.
  • Device Provisioning Service: The device data that a given IoT solution stores depends on the specific requirements of that solution. But, as a minimum, a solution must store device identities and authentication keys. Azure IoT Hub includes an identity registry that can store values for each device such as IDs, authentication keys, and status codes. A solution can use other Azure services such as table storage, blob storage, or Cosmos DB to store any additional device data. Device provisioning is the process of adding the initial device data to the stores in your solution. To enable a new device to connect to your hub, you must add a device ID and keys to the IoT Hub identity registry. As part of the provisioning process, you might need to initialize device-specific data in other solution stores. You can also use the Azure IoT Hub Device Provisioning Service to enable zero-touch, just-in-time provisioning to one or more IoT hubs without requiring human intervention. To learn more, see the provisioning service documentation.

  • Device Twin and Device Management: Device twins are JSON documents that store device state information including metadata, configurations, and conditions. Azure IoT Hub maintains a device twin for each device that you connect to IoT Hub.

  • IoT Edge: Azure IoT Edge moves cloud analytics and custom business logic to devices so that your organization can focus on business insights instead of data management. Scale out your IoT solution by packaging your business logic into standard containers, then you can deploy those containers to any of your devices and monitor it all from the cloud.
  • Device heartbeat : The IoT Hub identity registry contains a field called connectionState. Only use the connectionState field during development and debugging. IoT solutions should not query the field at run time. For example, do not query the connectionState field to check if a device is connected before you send a cloud-to-device message or an SMS. We recommend subscribing to the device disconnected event on Event Grid to get alerts and monitor the device connection state. Use this tutorial to learn how to integrate Device Connected and Device Disconnected events from IoT Hub in your IoT solution.

In order to have a low-cost solution, I think that you should consider send a batch of telemetry data (which means sending less device to cloud messages) if that something that can still answer to your technical/functional requirements.