This repository provides scripts and a web interface to set up and configure an AWS IoT TwinMaker workspace with IoT SiteWise assets for industrial digital twin applications.
This project enables the creation of digital twins for industrial systems using AWS IoT TwinMaker and AWS IoT SiteWise. The pipeline includes:
- TwinMaker Workspace Creation: Set up a TwinMaker workspace with necessary IAM roles and S3 storage
- IoT SiteWise Model Creation: Define asset models with properties, measurements, and attributes
- IoT SiteWise Asset Creation: Instantiate assets from models and configure MQTT notifications
- TwinMaker Entity Creation: Create component types and entities linked to SiteWise assets
- Integration Flow: Connect TwinMaker with SiteWise assets for comprehensive digital twin capabilities
- FastAPI Web Interface: Manage and monitor your digital twin infrastructure through a modern web UI
- AWS Account with appropriate permissions
- Python 3.6+
- AWS CLI configured locally (or use environment variables)
boto3Python SDK
Honeywell-inventor/
├── configs/ # Modular configuration files
│ ├── workspace.config.json # TwinMaker workspace and AWS credentials
│ ├── models.config.json # SiteWise model definitions
│ ├── entities.config.json # TwinMaker entity definitions
│ └── components.config.json # TwinMaker component type definitions
├── master-setup.sh # Master script to orchestrate the entire flow
├── run.sh # Script to create TwinMaker workspace
├── twin-maker-script.py # Python implementation for TwinMaker workspace
├── run-sitewise-model.sh # Script to create IoT SiteWise model
├── create-iotsitewise-model.py # Python implementation for SiteWise model creation
├── run-sitewise-asset.sh # Script to create IoT SiteWise asset
├── create-iotsitewise-asset.py # Python implementation for SiteWise asset creation
├── run-twinmaker-entities.sh # Script to create TwinMaker entities
├── create-twinmaker-entities.py # Python implementation for TwinMaker entities
├── config_loader.py # Modular configuration management system
├── set_aliases.py # Configure SiteWise asset property aliases
├── app.py # FastAPI web application (if present)
├── requirements.txt # Python dependencies
└── .env # Environment variables (create this file)
- Clone this repository
- Install Python dependencies:
pip install -r requirements.txt
- Create a
.envfile with your AWS credentials:AWS_ACCESS_KEY_ID=your_access_key_here AWS_SECRET_ACCESS_KEY=your_secret_key_here AWS_REGION=us-east-1
The project uses a modular configuration system with JSON files in the configs/ directory:
- workspace.config.json: AWS credentials, TwinMaker workspace settings, and IAM roles
- models.config.json: SiteWise asset model definitions with properties and measurements
- entities.config.json: TwinMaker entity definitions and component mappings
- components.config.json: TwinMaker component type definitions
The master script provides automated end-to-end deployment:
./master-setup.shThis will automatically:
- Create TwinMaker workspace with proper IAM roles
- Create all SiteWise models defined in configuration
- Create SiteWise assets for each model type
- Set up property aliases and MQTT notifications
- Create TwinMaker entities linked to SiteWise assets
- Generate data sender scripts for testing
If you have the FastAPI web application, start the web server:
python app.pyThen access the web interface at http://localhost:8000 to:
- Monitor deployment status
- View real-time metrics
- Manage digital twin components
- Access operational dashboards
./run.sh --workspace-id CookieFactoryTwinThis creates:
- AWS IoT TwinMaker workspace with configured ID
- Required IAM roles with appropriate permissions
- S3 bucket for storing workspace data
./run-sitewise-model.shThis creates models based on your configuration with:
- Defined properties, measurements, and attributes
- Proper data types and units
- Hierarchical model relationships
./run-sitewise-asset.sh <model-id> <model-type>This creates:
- Asset based on the specified model
- Enables MQTT notifications for all properties
- Configures property aliases for easy data access
./run-twinmaker-entities.sh <workspace-id>This creates:
- Component types linked to SiteWise models
- Entities synchronized with SiteWise assets
- Property mappings for real-time data flow
- Environment Setup: Create virtual environment and install dependencies
- Configuration Loading: Parse modular configuration files
- AWS Credential Validation: Verify and configure AWS access
- TwinMaker Workspace: Create workspace with IAM roles and S3 storage
- SiteWise Models: Create asset models based on configuration
- SiteWise Assets: Instantiate assets from models with notifications
- Property Aliases: Configure MQTT-friendly property paths
- TwinMaker Entities: Create digital twin entities linked to physical assets
- Data Generators: Set up scripts for testing and simulation
The ConfigLoader class provides:
- Environment variable substitution
- Modular configuration file loading
- Fallback to monolithic config.json
- Validation and error handling
- Dynamic configuration updates
After deployment:
- TwinMaker Console: Navigate to your workspace to view entities and scenes
- SiteWise Integration: Entities are automatically linked to SiteWise assets
- Real-time Data: Property values flow from SiteWise to TwinMaker
- 3D Visualization: Create scenes to visualize your digital twin
- Monitoring Dashboards: Use the web interface for operational insights
- Store AWS credentials in
.envfile (never commit to git) - Use IAM roles with least privilege principles
- Environment variables are substituted in configuration files
- The project supports both credential files and environment variables
- In production, use AWS IAM roles or AWS Secrets Manager
-
AWS Credential Errors:
- Verify credentials in
.envfile are valid - Check AWS CLI configuration with
aws configure - Ensure proper IAM permissions for TwinMaker and SiteWise
- Verify credentials in
-
Virtual Environment Issues:
- Ensure Python 3.6+ is installed
- Install
python3-venvif missing (sudo apt-get install python3-venv)
-
Configuration Errors:
- Validate JSON syntax in config files
- Check environment variable substitution
- Verify model and entity definitions
-
SiteWise Model/Asset Creation Failures:
- Check for proper IAM permissions
- Verify region compatibility for SiteWise
- Ensure model IDs are correctly formatted
- "Externally managed environment" Error: Scripts use isolated virtual environments
- Asset Creation Fails: Verify model ID format and model ACTIVE state
- TwinMaker Workspace Creation Fails: Check IAM permissions and S3 bucket access
- Entity Creation Fails: Ensure SiteWise assets exist and are properly configured
After setup, use the generated scripts to send test data:
# Example for different model types
./send-motor-data.sh
./send-sensor-data.sh
./send-conveyor-data.shThe system provides:
- Real-time asset property monitoring
- MQTT notification tracking
- Entity status validation
- Configuration drift detection
- Performance metrics via web interface
Contributions are welcome! Please feel free to submit pull requests or open issues.
This project is licensed under the MIT License - see the LICENSE file for details.