Skip to content

How to create my own factory and equipment in AWS IoT TwinMaker?

liyuanqian edited this page Jul 14, 2023 · 3 revisions

This article describes how to manage the models in your AWS IoT TwinMaker instance. Management operations include create, update, and deletion of models.

Prerequisites

To work with AWS IoT TwinMaker in this tutorial, you will need the following prerequisites:

  1. An AWS Account and the necessary permissions to use AWS IoT TwinMaker. If you already have an AWS IoT TwinMaker set up, you can proceed to the next section. Otherwise, follow the instructions to set up an account and configure authentication. The instructions will guide you through the necessary steps to ensure successful completion.
  2. A AWS IoT TwinMaker workspace. If you already have an AWS IoT TwinMaker workspace set up, you can proceed to the next section. Otherwise, follow the instructions to create one.

Developer tools

This article highlights how to complete different management operations using the AWS IoT TwinMaker Console. You can also craft these same management calls using the other tools like AWS CLI

  • AWS IoT TwinMaker Console: A web-based interface that offers a visual representation of your AWS IoT TwinMaker data, enabling you to manage models and build workflows.
  • AWS Command Line Interface (CLI): Provides a command-line interface to interact with and manage your AWS IoT TwinMaker data using CLI commands.

By leveraging these developer tools and interfaces, you can effectively manage models within your AWS IoT TwinMaker, enabling seamless integration and orchestration of your IoT devices and services.

Goals

"My company has its own factory with unique machines, different from CookieFactory. We are interested in using AWS IoT TwinMaker to build virtual replicas of our machines."

Entities in AWS IoT TwinMaker are digital representations of elements within a digital twin. These elements can include physical equipment, concepts, or processes. Each entity is associated with components that provide data and context for that entity.

Using AWS IoT TwinMaker, we can organize entities into custom hierarchies to facilitate efficient management. By default, the entity and component system is presented in a hierarchical view.

Let's consider an example where we have a Factory named "MyFactory" with two floors. On the first floor, there is a room called "Room1," inside which we have a specific equipment named "Equipment1." The Equipment1 further comprises a machine element referred to as "Element1." We will now proceed to create entities for each of these elements using the following steps.

HowTo_Entity_Relationship

AWS Console

In this section, we will guide you through the process of setting up models within AWS IoT TwinMaker to represent your buildings and devices using the AWS Console.

Step 1: Log into your AWS account Console and select the workspace that you own.

Step 2: In the left navigation tree, under "Workspaces," click on "Entities." On the page that appears on the right side, click the "Create" button and select "Create entity" from the drop-down list.

Step 3: Fill in the required information in the Create entity window using the following details:

  • Name: Enter the desired name for your entity, in this case, "MyFactory."
  • Unique entity ID: This field is optional and can be left blank for now. If the field is empty, AWS IoT TwinMaker will auto create a 36 characters entity ID for your entity. If not, AWS IoT TwinMaker will use the provided value as entity ID.
  • Description: Optionally, provide a description for your entity.
  • Tags: If you want to attach [AWS Tags] to the entity, click on "Add new tag" to specify the desired tags. To remove a tag, click on the "Remove" button. Once you have filled in the necessary information, click on "Create entity" to create your entity.

Step 4: Create child entities to represent the different elements of your factory, such as building floors, rooms, and equipment. Follow the steps below:

  • From the Entity list, locate and select "MyFactory."
  • Click on the "Create child entity" button, which will open the "Create child entity" window. The only difference from the previous page is the addition of an "Entity parent" row. By default, the parent entity will be the one you selected earlier.

We will now create the entities using the following relationship:

  • Building Floors: Create child entities under "MyFactory" to represent each floor.
  • Rooms: Create child entities under each floor entity to represent individual rooms.
  • Equipment: Create child entities under each room entity to represent specific equipment. Once the child entities have been created in AWS IoT TwinMaker, the Entities list will reflect the following structure:

Once the modeling process is complete, we will have the buildings and equipment modeled within AWS IoT TwinMaker. In the next phase, we will demonstrate how to associate report data, sensor time series data, and other data type with these entities. This will allow us to establish connections between the digital representations and the corresponding real-world data sources.

AWS CLI

You can use AWS AWS IoT TwinMaker create-entity to create the entities. 

Here we are using CookieFactoryV2 workspace as the example AWS IoT TwinMaker workspace, you could replace it into your own workspace Id. In this example, you could create the "MyFactory" entity by running the following command:

aws iottwinmaker create-entity --workspace-id CookieFactoryV2 --entity-name MyFactory --description 'My factory in Seattle' --tags Key=Factory,Value=MyFactory

To create the child entities, you could use the example of:

aws iottwinmaker create-entity --workspace-id CookieFactoryV2 --entity-name Floor1 --parent-entity-id <Parent Entity Id>

Clean up

If you wish to proceed with the next phase, please retain the entities. However, if you would like to delete the entities, please follow the steps below:

AWS Console

  1. Log into your AWS account Console and select the workspace that you own.

  2. In the left navigation tree, locate and select the entity MyFactory, Then, select the Actions dropdown list and choose View entity details to access the entity detail page.

  3. On the entity detail page, click on the Delete button located at the top right corner to remove the entity from AWS IoT TwinMaker.

AWS CLI

You can use AWS IoT TwinMaker CLI delete-entity command to delete the entities. Run the following command in your terminal:

aws iottwinmaker delete-entity --workspace-id CookieFactoryV2 --entity-id <MyFactory entity's entity ID> --is-recursive

In the above example, we are using CookieFactoryV2 workspace as the AWS IoT TwinMaker workspace. You should Replace the workspace Id with your own workspace Id.