cloudageit / aws-stf-dc-twinmaker-catversion

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Smart Territory Framework - Bulding a Digital Twin with the STF and AWS IoT TwinMaker


To learn what is the Smart Territory Framework (STF), start here.


You must have deployed the STF Core stack and the Data Consumer using Amazon Athena stack before proceeding with this one

Overview

This repository contains a CDK application that provisions resources in AWS IoT TwinMaker to make it easy to build Digital Twins using the STF IoT Datalake as a data source.

It shows you how to easily build a Digital Twin of a Classroom as illustrated below using the Smart Territory Framework and AWS IoT TwinMaker.


Demo


AWS IoT TwinMaker is an AWS IoT service that you can use to build operational digital twins of physical and digital systems. AWS IoT TwinMaker creates digital visualizations using measurements and analysis from a variety of real-world sensors, cameras, and enterprise applications to help you keep track of your physical factory, building, or industrial plant. You can use this real-world data to monitor operations, diagnose and correct errors, and optimize operations.

AWS IoT TwinMaker provides a unified data access API to read from and write to your digital twin’s source data.

This CDK application contains a stack that will create a Workspace, a Component that acts as a data connector to the STF IoT Datalake and one or multiple Entities for your IoT thing(s) (see the file things.ts)

The TwinMaker component contains a Lambda function that queries the data from the S3 bucket of STF IoT Datalake using Athena. You must have deployed the STF Core stack and the Data Consumer using Amazon Athena stack before proceeding with this one


Architecture


Prerequisites


To deploy this application, you need the following:

  • An AWS account. If you don't have one, see Set up an AWS account.
  • An AWS Identity and Access Management (IAM) user with administrator permissions
  • AWS CDK Toolkit installed. See Getting started with the AWS CDK to install it.
  • STF Core and Data Consumer using Amazon Athena deployed. The following CDK application requires the bucket name of the STF IoT Datalake, Athena Database and Table for the TwinMaker component to query. If you have kept the default names, you don't need to change anything.

Getting Started

The application includes a file parameters.ts in which you can define the name of the TwinMaker Workspace that will be created. You have also to provide the name of the Database, Table and Workgroup created in Athena. You can check the repository STF Data Consumer using Amazon Athena to see how to provision these.


Parameters


You have to provide the name of the STF IoT Datalake bucket (created with STF Core stack) in the file stf-dc-twinmaker-stack.ts. If you have kept the default name, you don't need to change anything.


Buckets


Finally, you must provide the names of the IoT things in the file things.ts, you want to create entities for in TwinMaker. This stack is designed to query entities of type IndoorEnvironmentObserved in the STF IoT Datalake. So, for each name provided in the file, an entity with the id urn:ngsi-ld:IndoorEnvironmentObserved:{thingName}.


Things


For example, if you have a thing named IndoorEnvironment-AM103-494c6f7665596f7542617961 in the file, the entity created in TwinMaker will have the id urn:ngsi-ld:IndoorEnvironmentObserved:IndoorEnvironment-AM103-494c6f7665596f7542617961.

This is id of the entity that the TwinMaker component will query in the STF IoT Datalake. See below the Athena Query resulted.


Athena


Once it is set up, you can deploy the application using the following commands:


npm install
cdk bootstrap
cdk deploy --all

Voilà. You have everything ready.

You can now create a Scene in TwinMaker to visualize your Twin and integrate it in Grafana to build a dashboard like the one above.

Additional Resources

This section provides links to additional resources that may help deploy and operate this application:

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

About

License:MIT No Attribution


Languages

Language:TypeScript 69.9%Language:JavaScript 30.1%