IoT Edge modules are execution units that run business logic. They are implemented as Docker compatible containers. Azure IoT edge modules contain Azure services or custom code and are the smallest unit handled by Azure IoT. There are four elements to an IoT edge module. They are as follows:
- Module image
- Module instance
- Module identity
- Module twin
A module image contains applications that use the management, communications and security features of the Azure IoT Edge runtime. A developer may create their own module image or export one from a supported Azure service. Module images exist in the cloud and may be used in different solutions. Every time a module image is deployed to a device, a new module instance is created once the IoT Edge runtime is started. The following diagram shows a module image that lives in the cloud and the deployment of this image in two different geographic locations (Canada and the United Kingdom):
You may deploy multiple module images and put them on any edge computer anywhere in the world. However, each module instance would be its own entity once the module is started.
Module identities are created whenever the Azure IoT Edge runtime creates a new module instance. Module identities are used for local and cloud communications for the module instance. Corresponding module twins are created for each module instance and used to configure the module instance. Module twins and module instances are associated with each other using the module entity. Module twins are JSON documents that store module information and configuration properties.