We use machine learning technology to do auto-translation. Click "English" on top navigation bar to check Chinese version.
How to replicate Amazon Web Services IoT SiteWise resources across environments
Introduction
As you scale your
To help customers replicate Amazon Web Services IoT SiteWise resources between environments, we created
Asset Model Export Walkthrough
The utilities in the Amazon Web Services IoT SiteWise Tools repository give you the flexibility to replicate only the resources you need for your specific use case. You can choose to only export Amazon Web Services IoT SiteWise asset models, or also export the corresponding assets and Amazon Web Services IoT SiteWise Monitor dashboards. The export tool can be used manually from the command line (e.g. for a one-time export of an asset model into another environment) or can be integrated into your automation pipelines for CI/CD deployment scenarios. The utility can also be used to copy Amazon Web Services IoT SiteWise resources for multi-region deployments within the same account. The Amazon Web Services IoT SiteWise Tools repository has detailed documentation on how to use each of the utilities but for a basic demonstration of the tools, we created two asset models of a CNC Machine and Production Line as seen below. Each model contains a property and a hierarchical relationship between the two models.
To keep it simple, we will only export the models. Using the Amazon Web Services IoT SiteWise export tools, we optionally specify the region we want to export models from and run the command with no other flags (if you also want to export assets along with the models, you would simply add the -a, --assets
flag). The command output will look something like the following:
If the command succeeds, a CloudFormation template will be saved to a folder in the local directory named cfnexport. In our example case the CloudFormation will look like the following:
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "SiteWise Export",
"Resources": {
"CNCMachineResource": {
"Type": "AWS::IoTSiteWise::AssetModel",
"Properties": {
"AssetModelName": "CNC Machine",
"AssetModelProperties": [
{
"Name": "SpindleSpeed",
"DataType": "DOUBLE",
"Unit": "RPM",
"Type": {
"TypeName": "Measurement"
},
"LogicalId": "SpindleSpeed9f2e03dd"
}
],
"AssetModelHierarchies": []
}
},
"ProductionLineResource": {
"Type": "AWS::IoTSiteWise::AssetModel",
"Properties": {
"AssetModelName": "Production Line",
"AssetModelProperties": [
{
"Name": "Location",
"DataType": "STRING",
"Type": {
"TypeName": "Attribute",
"Attribute": {}
},
"LogicalId": "Locationafc85231"
}
],
"AssetModelHierarchies": [
{
"Name": "CNC Machines",
"ChildAssetModelId": {
"Ref": "CNCMachineResource"
},
"LogicalId": "CNCMachines"
}
]
}
}
}
}
This CloudFormation template can now be launched in another region or another Amazon Web Services Account to create the same asset models we defined above.
That’s it, now you have an understanding how the export utility works. In the next section we will provide an example architecture that shows how you can integrate the utilities into your CI/CD automation pipelines.
Example CI/CD Architecture
In this example architecture we assume you have an existing CI/CD pipeline that can deploy Amazon Web Services services using CloudFormation and the Amazon Web Services SDKs.
Build
For the build stage of the architecture, the CI/CD pipeline initiates a
Deploy
In the deploy stage, the Amazon Web Services IoT SiteWise resources need to be created or modified in a specific order in the target environment, namely, asset models, assets, and dashboards. To do this,
Once the stacks are created, subsequent updates from the CI/CD pipeline will use the workflow and step functions to update those stacks which will modify and update the Amazon Web Services IoT SiteWise resources. The asset and dashboard states will wait for the previous state to finish deploying in CloudFormation before they start because they require those resources to exist before they can be created. Please see the architecture below for a visual representation.
For production workloads, customers can use CloudFormation
Conclusion
In this blog post we introduced the
About the Authors
![]() |
![]() |
![]() |
![]() |
The mentioned AWS GenAI Services service names relating to generative AI are only available or previewed in the Global Regions. Amazon Web Services China promotes AWS GenAI Services relating to generative AI solely for China-to-global business purposes and/or advanced technology introduction.