Understanding Azure IoT Edge Modules
Azure IoT Edge enables you to move cloud analytics and custom business logic to your IoT devices. This is done by deploying and managing these computations as modules. Modules are the fundamental building blocks of IoT Edge deployments.
Module Concepts
A module is a process that runs on an IoT Edge device. It can be a piece of business logic, a device management service, or an Azure service such as Azure Stream Analytics. Modules can communicate with each other and with the cloud.
- Isolation: Modules run in isolated containers, ensuring that they don't interfere with each other.
- Communication: Modules can publish and subscribe to topics using the IoT Edge device's local message broker.
- Management: Modules are managed through the IoT Edge agent and can be deployed, configured, and updated remotely.
Module Identity
Each module deployed on an IoT Edge device requires a module identity. This identity is created in Azure IoT Hub and provides a unique name for the module, allowing it to authenticate with IoT Hub and communicate securely. Module identities are distinct from device identities.
Note: A device can have multiple module identities associated with its device identity.
Module Twin
Similar to a device twin, each module has a corresponding module twin in IoT Hub. The module twin is a JSON document that stores information about the module's state, desired properties, and reported properties. This allows for seamless synchronization between the module on the device and its representation in the cloud.
- Desired Properties: These are set by the cloud and are communicated to the module.
- Reported Properties: These are set by the module and are reported back to the cloud.
- Tags: Arbitrary metadata that can be used for querying and organizing modules.
Creating Custom Modules
You can develop your own custom modules to implement specific business logic. IoT Edge supports various development languages and frameworks, including:
- C# with .NET Core
- Python
- Node.js
- Java
- C
To create custom modules, you typically use the Azure IoT Edge SDKs and containerization technologies like Docker. You'll define your module's logic, package it as a container image, and then configure its deployment in IoT Hub.
Prebuilt Modules
Azure IoT Edge provides several prebuilt modules that offer common functionalities out-of-the-box:
- IoT Edge Agent: The core component responsible for deploying, managing, and monitoring modules on an edge device.
- IoT Edge Hub: Provides a local endpoint for modules and devices to connect to, manage communication between modules, and communicate with IoT Hub.
- Azure Stream Analytics module: Allows you to run Azure Stream Analytics jobs directly on your edge devices for real-time data processing.
- Azure Blob Storage module: Enables you to store data locally on edge devices and sync it with Azure Blob Storage in the cloud.
- Azure Functions module: Lets you run serverless code at the edge.
Important: Understanding the roles and capabilities of these prebuilt modules is crucial for designing efficient IoT Edge solutions.
For detailed guidance on creating and deploying modules, refer to the following resources: