AWS News Blog
Now Available – AWS IoT Things Graph
|
Update November 9, 2022 – AWS IoT Things Graph has been transitioned to AWS IoT TwinMaker. To learn more, please visit the AWS IoT TwinMaker page here. In an effort to ensure a great experience, expired links in this post have also been updated or removed.
We announced AWS IoT Things Graph last November and described it as a tool to let you build IoT applications visually. Today I am happy to let you know that the service is now available and ready for you to use!
As you will see in a moment, you can represent your business logic in a flow composed of devices and services. Each web service and each type of device (sensor, camera, display, and so forth) is represented in Things Graph as a model. The models hide the implementation details that are peculiar to a particular brand or model of device, and allow you to build flows that can evolve along with your hardware. Each model has a set of actions (inputs), events (outputs), and states (attributes). Things Graph includes a set of predefined models, and also allows you to define your own. You can also use mappings as part of your flow to convert the output from one device into the form expected by other devices. After you build your flow, you can deploy it to the AWS Cloud or an AWS IoT Greengrass-enabled device for local execution. The flow, once deployed, orchestrates interactions between locally connected devices and web services.
Using AWS IoT Things Graph
Let’s take a quick walk through the AWS IoT Things Graph Console!
The first step is to make sure that I have models which represent the devices and web services that I plan to use in my flow. I click Models in the console navigation to get started:
The console outlines the three steps that I must follow to create a model, and also lists my existing models:
The presence of aws/examples
in the URN for each of the devices listed above indicates that they are predefined, and part of the public AWS IoT Things Graph namespace. I click on Camera to learn more about this model; I can see the Properties, Actions, and Events:
The model is defined using GraphQL; I can view it, edit it, or upload a file that contains a model definition. Here’s the definition of the Camera:
This model defines an abstract Camera device. The model, in turn, can reference definitions for one or more actual devices, as listed in the Devices section:
Each of the devices is also defined using GraphQL. Of particular interest is the use of MQTT topics & messages to define actions:
Earlier, I mentioned that models can also represent web services. When a flow that references a model of this type is deployed, activating an action on the model invokes a Greengrass Lambda function. Here’s how a web service is defined:
Now I can create a flow. I click Flows in the navigation, and click Create flow:
I give my flow a name and enter a description:
I start with an empty canvas, and then drag nodes (Devices, Services, or Logic) to it:
For this demo (which is fully explained in the AWS IoT Things Graph User Guide), I’ll use a MotionSensor, a Camera, and a Screen:
I connect the devices to define the flow:
Then I configure and customize it. There are lots of choices and settings, so I’ll show you a few highlights, and refer you to the User Guide for more info. I set up the MotionSensor so that a change of state initiates this flow:
I also (not shown) configure the Camera to perform the Capture action, and the Screen to display it. I could also make use of the predefined Services:
I can also add Logic to my flow:
Like the models, my flow is ultimately defined in GraphQL (I can view and edit it directly if desired):
At this point I have defined my flow, and I click Publish to make it available for deployment:
The next steps are:
Associate – This step assigns an actual AWS IoT Thing to a device model. I select a Thing, and then choose a device model, and repeat this step for each device model in my flow:
Deploy – I create a Flow Configuration, target it at the Cloud or Greengrass, and use it to deploy my flow (read Creating Flow Configurations to learn more).
Things to Know
I’ve barely scratched the surface here; AWS IoT Things Graph provides you with a lot of power and flexibility and I’ll leave you to discover more on your own!
Here are a couple of things to keep in mind:
Pricing – Pricing is based on the number of steps executed (for cloud deployments) or deployments (for edge deployments), and is detailed on the AWS IoT Things Graph Pricing page.
API Access – In addition to console access, you can use the AWS IoT Things Graph API to build your models and flows.
Regions – AWS IoT Things Graph is available in the US East (N. Virginia), US West (Oregon), Europe (Ireland), Asia Pacific (Sydney), and Asia Pacific (Tokyo) Regions.
— Jeff;