Best Practices for Smooth Migration to Alibaba Cloud IoT Platform Without Modifying Existing Devices

Detailed Explanation of AIoT Technology

Issue11

Background
In the field of the Internet of Things (IoT), as the scale of enterprise business gradually expands, the number of terminal devices increases. The cost of self-built MQTT cluster horizontal expansion and ongoing maintenance becomes increasingly high. There is an urgent need to find a highly reliable, secure, low-cost, and maintenance-free IoT enterprise full-managed service while ensuring that existing devices distributed nationwide undergo zero modification to achieve the migration of MQTT services.
The cloud gateway launched by Alibaba Cloud IoT platform perfectly solves the stability and scalability bottlenecks encountered after the expansion of enterprise scale. During the migration process, no upgrades or modifications are required on the device side; it is only necessary to adjust the original MQTT domain name to point to the cloud gateway domain name created by the Alibaba Cloud IoT enterprise instance.
Overall Migration Plan
The overall plan for migrating existing devices from a self-built MQTT cluster to Alibaba Cloud IoT is as follows:

Best Practices for Smooth Migration to Alibaba Cloud IoT Platform Without Modifying Existing Devices

Practical Migration of Existing Devices
1. Activate IoT Enterprise Instance
First, we log in to the Alibaba Cloud official website to activate the IoT enterprise instance (Exclusive Type).
https://common-buy.aliyun.com/?commodityCode=iot_instc_public_cn#/

Best Practices for Smooth Migration to Alibaba Cloud IoT Platform Without Modifying Existing Devices

2. Create Cloud Gateway
In the exclusive enterprise IoT instance, create a cloud gateway. Choose the MQTT protocol and select the authentication method based on the actual situation of the devices. Configure the domain name of the self-built MQTT to correspond to the TLS authentication certificate and secret key.

Best Practices for Smooth Migration to Alibaba Cloud IoT Platform Without Modifying Existing Devices

Best Practices for Smooth Migration to Alibaba Cloud IoT Platform Without Modifying Existing Devices
For detailed operational documentation, please visit:
https://help.aliyun.com/document_detail/433804.html
3. Register Existing Device Identity to Cloud Gateway
After creating the cloud gateway, a product will be created: Cloud Gateway xxx.

Best Practices for Smooth Migration to Alibaba Cloud IoT Platform Without Modifying Existing Devices

Next, we need to batch register the identity authentication information of the existing devices under the cloud gateway product.

Best Practices for Smooth Migration to Alibaba Cloud IoT Platform Without Modifying Existing Devices

The CSV format for batch registration of devices is as follows:

Best Practices for Smooth Migration to Alibaba Cloud IoT Platform Without Modifying Existing Devices

After successful registration, when the existing devices initiate an MQTT CONNECT request, the Alibaba Cloud IoT cloud gateway can verify the legitimacy of the device identity.
When we have a large number of devices, we can register via API to free our hands!
4. Rule Engine Data Flow
To achieve real-time data flow, we need to configure the rule engine in the cloud product flow, including data source, data destination, and parser script.

Best Practices for Smooth Migration to Alibaba Cloud IoT Platform Without Modifying Existing Devices

4.1 Create Data Source
When creating a data source, we need to register the Topic where our devices originally reported data into the data source.

Best Practices for Smooth Migration to Alibaba Cloud IoT Platform Without Modifying Existing Devices

4.2 Create Data Destination
The data destination refers to the system we use to receive data reported by devices, which can be a database, message queue, function computation, etc. Here we choose AMQP server subscription.

Best Practices for Smooth Migration to Alibaba Cloud IoT Platform Without Modifying Existing Devices

Best Practices for Smooth Migration to Alibaba Cloud IoT Platform Without Modifying Existing Devices

4.3 Write Parsing Script
In the parser script, we extract the message body from the data source and directly flow it to the AMQP consumer group. You can also process the data according to business needs before forwarding it to downstream cloud products.

Best Practices for Smooth Migration to Alibaba Cloud IoT Platform Without Modifying Existing Devices

5. Modify Domain Name to Point to Cloud Gateway
After creating the cloud gateway, we will obtain a URL address for the gateway. At this point, it is necessary to log in to the domain service provider’s management background and modify the self-built MQTT access domain to redirect to the cloud gateway URL. This way, the connections of existing devices will flow to the Alibaba Cloud IoT cloud gateway, and the self-built MQTT cluster can be taken offline.

Best Practices for Smooth Migration to Alibaba Cloud IoT Platform Without Modifying Existing Devices

6. Devices Successfully Connected to Alibaba Cloud IoT
After the original MQTT domain name adjustment takes effect, we observe that the devices successfully connect to the Alibaba Cloud IoT platform, showing as online, and we can see the topics subscribed by the devices in the subscribed topic list.

Best Practices for Smooth Migration to Alibaba Cloud IoT Platform Without Modifying Existing Devices

In the log service, we can also observe the logs of the devices being online.

Best Practices for Smooth Migration to Alibaba Cloud IoT Platform Without Modifying Existing Devices

7. Devices Report Data to Alibaba Cloud IoT
When devices report business data, it will flow to the downstream system in real-time according to the configuration of the rule engine. The complete log record is as follows:
Best Practices for Smooth Migration to Alibaba Cloud IoT Platform Without Modifying Existing Devices
We can also visualize the data flow chain through message tracking.

Best Practices for Smooth Migration to Alibaba Cloud IoT Platform Without Modifying Existing Devices

In the consumer group subscribed on the server side, we can view information such as message consumption rate, message backlog, consumer list, etc.

Best Practices for Smooth Migration to Alibaba Cloud IoT Platform Without Modifying Existing Devices

8. Cloud Sends Control Commands to Devices
Through the Pub interface of the Alibaba Cloud IoT enterprise instance, we can send control commands to specified devices.
https://help.aliyun.com/document_detail/69793.htm

Best Practices for Smooth Migration to Alibaba Cloud IoT Platform Without Modifying Existing Devices

After calling the Pub interface, we can check the logs of the control commands sent to the devices in the log service.

Best Practices for Smooth Migration to Alibaba Cloud IoT Platform Without Modifying Existing Devices

We can also visualize the data flow chain through message tracking.

Best Practices for Smooth Migration to Alibaba Cloud IoT Platform Without Modifying Existing Devices

Thus, we have completed the migration of existing devices from a self-built MQTT cluster to the Alibaba Cloud IoT fully managed enterprise IoT platform, unafraid of business scale growth, enjoying a 99.99% service quality guarantee, and finally able to sleep soundly!

Leave a Comment