AWS IoT TwinMaker
Introduction
The AWS IoT TwinMaker connector allows you to connect your Mendix app to AWS IoT TwinMaker and read data from the digital twin of your system.
Typical Use Cases
AWS IoT TwinMaker makes it easier for developers to create digital twins of real-world systems such as buildings, factories, industrial equipment, and production lines. AWS IoT TwinMaker provides the tools you need to build digital twins to help you optimize building operations, increase production output, and improve equipment performance. With the ability to use existing data from multiple sources, create virtual representations of any physical environment, and combine existing 3D models with real-world data, you can now harness digital twins to create a holistic view of your operations faster and with less effort. When used with your Mendix app, the AWS IoT TwinMaker connector enables you to build actionable dashboards on top of AWS IoT Twinmaker, and build applications on top of the service with little coding experience required.
Prerequisites
The AWS IoT TwinMaker connector requires Mendix Studio Pro version 9.18.3 or above.
To authenticate with Amazon Web Service (AWS), you must also install and configure the AWS authentication connector version 2.1 or higher. If you are using the AWS IoT TwinMaker connector version 3.0.0 or higher, it requires the AWS Authentication connector version 3.0.0 or higher. For more information about installing and configuring the AWS Authentication connector, see AWS Authentication.
Licensing and Cost
This connector is available as a free download from the Mendix Marketplace, but the AWS service to which is connects may incur a usage cost. For more information, refer to AWS documentation.
Depending on your use case, your deployment environment, and the type of app that you want to build, you may also need a license for your Mendix app. For more information, refer to Licensing Apps.
Installation
Follow the instructions in How to Use Marketplace Content to import the AWS IoT TwinMaker connector into your app.
Configuration
After you install the connector, you can find it in the App Explorer, in the AWSTwinMakerConnector section. The connector provides a domain model and several activities that you can use to connect your app to AWS IoT TwinMaker. Each activity can be implemented by using it in a microflow. To ensure that your app can connect to the AWS service, you must also configure AWS authentication for the connector.
Configuring AWS Authentication
In order to use the AWS IoT TwinMaker service, you must authenticate with AWS. To do so, you must set up a configuration profile in your Mendix app. After you set up the configuration profile, the connector module handles the authentication internally.
As of version 3.0.0 of the AWS Authentication Connector, all the resources and logic required to set up authentication are centralized inside the AWS Authentication Connector module.
The AWS Authentication Connector supports both static credentials and temporary credentials. For more information and detailed instructions please refer to the AWS Authentication Connector documentation page.
Configuring a Microflow for an AWS Service
After you configure the authentication profile for AWS IoT TwinMaker, you can implement the functions of the connector by using the provided activities in microflows. For example, to list all workspaces, implement the ListWorkspace activity by doing the following steps:
-
In the App Explorer, find and open the domain model for your app.
-
Right-click on the working area of the domain model, and then click Add entity.
-
Open the new entity by double-clicking on it.
-
Name the entity MyWorkspace.
-
In the Attributes section, click New, and then add a String-type attribute named WorkspaceID.
-
In the App Explorer, right-click on the name of your module, and then click Add microflow.
-
Enter a name for your microflow, for example, DS_ListWorkspaces, and then click OK.
-
In the App Explorer, in the AWSTwinMakerConnector > Microflows section, find the ListWorkspaces activity.
-
Drag the ListWorkspaces activity onto the work area of your microflow.
-
In the Properties pane for the microflow, in the Security section, select a user role that should be allowed to run the microflow.
-
Double-click the ListWorkspaces activity to configure the required parameters.
For the
ListWorkspaces
activity, you must make a ListWorkspaceRequest, as well as specify the region for which you want to retrieve the tables. Other activities may have different required parameters. -
Click Edit parameter value, edit the AWS_Region parameter, and change Type to Expression.
-
In the expression builder, type
ENUM_Region
, and then press Ctrl + Space. -
In the autocomplete dialog, select AWSAuthentication.ENUM_Region, then type . and select your AWS region from the list.
-
Click OK, and then click OK again.
-
In the Toolbox pane, search for the Create Object activity, drag it onto the microflow area, and position it between the microflow start event and the ListWorkspaces activity.
-
Double-click the Create Object activity, and then select AWSTwinMakerConnector.ListWorkspacesRequest as the entity.
-
Double-click the ListWorkspaces activity.
-
Click Edit parameter value, edit the ListWorkspacesRequest parameter, and let it auto-fill.
-
In the Object name field, enter ListWorkspacesResponse, and then click OK.
-
In the Toolbox pane, search for the Retrieve activity and drag it onto the microflow area.
-
Position the Retrieve activity between the ListWorkspaces activity and the microflow end event.
-
Double-click the Retrieve activity.
-
In the Association section, click Select, and then select ListWorkspacesResponse_WorkspaceSummary as the association.
-
In the List name field, enter WorkspaceSummaryList, and then click OK.
-
In the Toolbox pane, search for the Create List activity, drag it onto the microflow area, and then position it after the Retrieve activity.
-
Double-click the Create List activity.
-
In the Action section, click Select, and then select {module name}.MyWorkspace as the action.
-
In the List name field, enter MyWorkspaceList, and then click OK.
-
In the Toolbox pane, search for the Loop activity, drag it onto the microflow area, and then position it before the microflow end event.
-
Double-click the Loop activity.
-
In the Iterate over list, select WorkspaceSummaryList.
-
In the Loop object name field, enter IteratorWorkspaceSummary.
-
In the Toolbox pane, search for the Create Object activity and drag it inside the loop area.
-
Double-click the Create Object activity.
-
In the Entity section, click Select, and then select {module name}.MyWorkspace as the entity.
-
In the list of parameters, click New.
-
Configure the parameter in the following way:
- In the Member field, select WorkspaceID.
- In the Value field, enter $IteratorWorkspaceSummary/WorkspaceID.
- Click OK.
-
In the Object name field, enter NewMyWorkspace, and then click OK.
-
In the Toolbox pane, search for the Change List activity and drag it inside the loop area, to the right of the Create Object activity.
-
Connect the Create Object activity to the Change List activity.
-
Double-click the Change List activity, and then set the following values:
- List - MyWorkspaceList
- Type - Add
- Value - $NewMyWorkspace
-
Double-click the end event of your microflow, and then set the following values:
- Type - List
- Entity - {module name}.MyWorkspace
- Return value - $MyWorkspaceList
-
Provide a way for users of your app to trigger the microflow by doing the following steps:
- In the App Explorer, right-click on the name of your module, and then click Add page.
- In the Lists category, select the List template for the page.
- Enter a name for your page, for example, Workspaces_Overview, and then click OK.
- On the page, double-click the List view widget.
- In the Select Data Source dialog, set the Type to Microflow.
- In the Microflow field, select the DS_ListWorkspaces microflow.
- Click OK, and then click Yes.
- In the Properties pane for the page, in the Navigation > Visible for section, select a user role that should be allowed to run the microflow.
- In the App Explorer, double-click the Navigation for your app.
- In the Menu section, click New Item.
- In the New Menu Item dialog, configure the following settings:
- Caption - A caption for the navigation item, for example, Workspace
- Icon - An icon that will be displayed for this page in the navigation for your app
- On click - Show a page
- Page - Your Table_Overview page
- Click OK.
-
Click Run Locally () to preview your app and validate your results. AWS IoT TwinMaker will return the workspaces it finds (by default 25, but you can increase it up to 250 workspaces by using the
MaxResults
attribute). For more information, see Studio Pro Overview: Run and View App.
Technical Reference
The module includes technical reference documentation for the available entities, enumerations, activities, and other items that you can use in your application. You can view the information about each object in context by using the Documentation pane in Studio Pro.
The Documentation pane displays the documentation for the currently selected element. To view it, perform the following steps:
-
In the View menu of Studio Pro, select Documentation.
-
Click on the element for which you want to view the documentation.