One IoT application development tool for different cloud platforms Azure and Amazon

Sergii Bielskyi
4 min readOct 15, 2019

--

Today, I would like to share my experience how I have used one tool to build telemetry IoT simulators for different cloud platforms. There were Azure and Amazon platforms.

This story is about one programming tool that helped me to build a flow simulator for sending telemetry data to Azure IoT hub and Amazon IoT at the same time. Before, doing all these stuff you need to configure devices in Azure IoT hub (https://docs.microsoft.com/en-us/azure/iot-hub/quickstart-send-telemetry-dotnet) and in AWS IoT (https://docs.aws.amazon.com/iot/latest/developerguide/register-device.html) as well.

Node-RED tool

The tool is called Node-RED (https://nodered.org/).

Node-RED is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its runtime in a single click.

Well, let’s create one flow like this below,

In this flow, I have used a few nodes:

  1. Injects a message into a flow either manually or at regular intervals. The message payload can be a variety of types, including strings, JavaScript objects or the current time.
  2. A JavaScript function block to run against the messages being received by the node.
  3. A simple node that sends the message payloads to Azure IoT Hub.
  4. Connects to a MQTT broker and subscribes to messages from the specified topic.

Let’s take a deeper look at each node.

Injects

Injects node properties

Payload filed type should be JSON. For Azure IoT hub message needs to be like this:

The sample of telemetry message
  • deviceId is your device’s unique id.
  • key is your device’s primary or secondary key.
  • protocol options are: amqp, amqpws, mqtt or http.
  • data can either be a plain string or string wrapped JSON.

Function

The message is passed in as an object called msg. By convention, it will have a msg.payload property containing the body of the message.

Function node properties

Azure IoT hub

In this node, you need to put the name of your Azure IoT hub. Do not forget to select the type of protocol. It should be amqp. This node is not installed by default. You need to execute several steps described here — https://flows.nodered.org/node/node-red-contrib-azure-iot-hub

Overview of Azure IoT hub
Azure IoT hub node properties

MQTT node

This node requires a connection to a MQTT broker to be configured. First, you need to configure server endpoint.

MQQT broker connection properties

You need to put a connection address of your AWS IoT. After that, you should configure certificates.

Certificate properties

All necessary certificates you can find in AWS IoT console.

AWS wizard to create a certificate

The last thing you need to do is deploying the flow by clicking the button “Deploy”.

As the result you can check the telemetry will come in Azure and AWS IoT platforms.

Azure IoT hub explorer console
AWS IoT console

Happy coding.

--

--

Sergii Bielskyi
Sergii Bielskyi

Written by Sergii Bielskyi

Cloud is more that you imagine… Microsoft Azure MVP | Founder of IoT community in Ukraine | MCPD | MCTS | MCP

No responses yet