How to Implement Dynamic Registration of IoT Devices Using Alibaba Cloud Function Compute

In this article, we will discuss how we can implement dynamic registration of Internet of Things (IoT) devices the serverless way using Alibaba Cloud Function Compute.

Image for post
Image for post

The figure above only demonstrates the core process of dynamically registering devices through the API, but the production environment must add security verification logic based on the enterprise situation to ensure the identity security of the devices.

Technical Implementation

  1. The device is activated and carries the deviceId (device unique identifier) to initiate the HTTPS request to FC
  2. FC calls the RegåisterDevice interface of the IoT Platform and passes the productKey and deviceId
  3. If it succeeds, return the device trituples
  4. If it fails, call the QueryDeviceDetail interface of the IoT Platform, pass the productKey and deviceId, and obtain the device trituples
  5. After obtaining the trituples, the device connects the Alibaba Cloud IoT Platform through MQTT.

This involves the use of the RegisterDevice and QueryDeviceDetail APIs.

RegisterDevice https://www.alibabacloud.com/help/doc-detail/69470.htm

QueryDeviceDetail https://www.alibabacloud.com/help/doc-detail/69594.htm

https://help.aliyun.com/document_detail/69594.html

Implementation on Function Compute

Node.js

Triggering Function Compute from the Device

The device obtains the trituples by triggering Function Compute through HTTP POST Json

Image for post
Image for post

To learn more about Alibaba Cloud’s Internet of Things (IoT) Platform, visit https://www.alibabacloud.com/product/iot

Reference:https://www.alibabacloud.com/blog/how-to-implement-dynamic-registration-of-iot-devices-using-alibaba-cloud-function-compute_594345?spm=a2c41.12498790.0.0

Written by

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store