Wednesday, March 22, 2023
HomeIoTThe way to replicate AWS IoT SiteWise sources throughout environments

The way to replicate AWS IoT SiteWise sources throughout environments


Introduction

As you scale your AWS IoT SiteWise purposes and transfer them into manufacturing, you could contemplate adopting frequent CI/CD methodologies that separate improvement and QA environments from manufacturing environments. This separation means that you can automate the deployment of those purposes by way of deployment pipelines. You additionally could have a number of enterprise models and/or industrial websites with frequent asset fashions and hierarchies that you just want to share and reuse throughout your group. In these instances, clients usually have completely different AWS accounts to separate environments, whether or not between dev and prod or between completely different enterprise models. The next diagram depicts such an instance the place improvement is separated from QA and manufacturing environments:

Source to Target Diagram
To assist clients replicate AWS IoT SiteWise sources between environments, we created AWS IoT SiteWise Instruments, a set of utilities that enable you export AWS IoT SiteWise Asset Fashions, Property, and AWS IoT SiteWise Monitor Dashboards into AWS CloudFormation templates. The exported templates can then be used to recreate the exported sources into one other AWS atmosphere. On this weblog, you will notice a pattern walkthrough of how one can use AWS IoT SiteWise Instruments to export fashions adopted by an instance structure of how one can automate the export and replication course of in a CI/CD pipeline.

Asset Mannequin Export Walkthrough

The utilities within the AWS IoT SiteWise Instruments repository provide the flexibility to duplicate solely the sources you want on your particular use case. You may select to solely export AWS IoT SiteWise asset fashions, or additionally export the corresponding belongings and AWS IoT SiteWise Monitor dashboards. The export device can be utilized manually from the command line (e.g. for a one-time export of an asset mannequin into one other atmosphere) or could be built-in into your automation pipelines for CI/CD deployment eventualities. The utility may also be used to repeat AWS IoT SiteWise sources for multi-region deployments inside the similar account. The AWS IoT SiteWise Instruments repository has detailed documentation on how one can use every of the utilities however for a primary demonstration of the instruments, we created two asset fashions of a CNC Machine and Manufacturing Line as seen under. Every mannequin accommodates a property and a hierarchical relationship between the 2 fashions.

Sitewise Export Walkthrough 1

To maintain it easy, we’ll solely export the fashions. Utilizing the AWS IoT SiteWise export instruments, we optionally specify the area we wish to export fashions from and run the command with no different flags (for those who additionally wish to export belongings together with the fashions, you’d merely add the -a, --assets flag). The command output will look one thing like the next:

Sitewise Export Walkthrough 2

If the command succeeds, a CloudFormation template shall be saved to a folder within the native listing named cfnexport. In our instance case the CloudFormation will seem like the next:

{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Description": "SiteWise Export",
    "Assets": {
        "CNCMachineResource": {
            "Sort": "AWS::IoTSiteWise::AssetModel",
            "Properties": {
                "AssetModelName": "CNC Machine",
                "AssetModelProperties": [
                    {
                        "Name": "SpindleSpeed",
                        "DataType": "DOUBLE",
                        "Unit": "RPM",
                        "Type": {
                            "TypeName": "Measurement"
                        },
                        "LogicalId": "SpindleSpeed9f2e03dd"
                    }
                ],
                "AssetModelHierarchies": []
            }
        },
        "ProductionLineResource": {
            "Sort": "AWS::IoTSiteWise::AssetModel",
            "Properties": {
                "AssetModelName": "Manufacturing 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 one other area or one other AWS Account to create the identical asset fashions we outlined above.

That’s it, now you may have an understanding how the export utility works. Within the subsequent part we’ll present an instance structure that reveals how one can combine the utilities into your CI/CD automation pipelines.

Instance CI/CD Structure

On this instance structure we assume you may have an present CI/CD pipeline that may deploy AWS providers utilizing CloudFormation and the AWS SDKs.

Construct

For the construct stage of the structure, the CI/CD pipeline initiates a Step Operate workflow within the supply atmosphere which executes three Lambda capabilities, one for every useful resource kind – asset fashions, belongings, and dashboards. The Lambda capabilities could be run in parallel and use the export utilities to question the AWS IoT SiteWise service API to generate the corresponding CloudFormation templates for the sources you want to replicate. The Lambda operate will then retailer the generated information in an Amazon S3 bucket to be used in the course of the deploy stage of the pipeline. For the S3 bucket, you’ll be able to both use a standard shared bucket throughout your whole AWS environments or use S3 replication to mechanically copy the information between separate buckets in every atmosphere.

Deploy

Within the deploy stage, the AWS IoT SiteWise sources should be created or modified in a selected order within the goal atmosphere, specifically, asset fashions, belongings, and dashboards. To do that, AWS StepFunction workflow states are outlined for every useful resource kind and the workflow is configured to execute them within the correct order. Every workflow state will use Lambda operate duties that reference the corresponding CloudFormation template in S3. The sources first should be created by the CI/CD pipeline, subsequently the preliminary workflow deployment duties will create the CloudFormation stacks.

As soon as the stacks are created, subsequent updates from the CI/CD pipeline will use the workflow and step capabilities to replace these stacks which can modify and replace the AWS IoT SiteWise sources. The asset and dashboard states will anticipate the earlier state to complete deploying in CloudFormation earlier than they begin as a result of they require these sources to exist earlier than they are often created. Please see the structure under for a visible illustration.

CI/CD Architecture

For manufacturing workloads, clients can use CloudFormation change units of their deployment pipeline and have a handbook approval gate to confirm the CloudFormation updates earlier than they’re made. Lastly, if dashboards are a part of your deployment pipeline, an AWS IoT SiteWise Monitor Portal have to be created beforehand within the goal atmosphere.

Conclusion

On this weblog put up we launched the AWS IoT SiteWise Instruments for replicating AWS IoT SiteWise sources between AWS environments and confirmed an instance structure how they are often built-in into an automatic deployment pipeline. We acknowledge that every group has completely different necessities, procedures and instruments relating to automating and deploying their IT infrastructure and purposes. We designed the instruments to be versatile to adapt the structure on your personal necessities and to have the ability to combine them into your particular automation pipelines. We welcome enhancements or additions to the utilities. When you have one thing to contribute again to the repository, be happy to submit a pull request within the repository for evaluate.

In regards to the Authors

Sebastian Salomon is a Sr IoT Knowledge Architect with Amazon Internet Companies. He has 7+ years of expertise in IoT structure in numerous vertical like IIoT, Automotive, O&G, Sensible Dwelling, Sensible Metropolis and Mining in addition to knowledge warehousing and large knowledge platform. Within the newest years he bought focus in how one can convey AI to IoT by way of scalable MLOps platforms. As a member of AWS Skilled Companies, He works with clients of various scale and industries architecting and implementing a wide range of finish to finish IoT options.
Ashok Padmanabhan is a Sr. IoT Knowledge architect with AWS Skilled providers specializing in Huge Knowledge Analytics & trade 4.0 options in Manufacturing area.
Mihai Lucaciu, with over 16 years of expertise, is a Senior IoT Knowledge Architect at AWS Skilled Companies, passionately serving to clients with answer architectures, designs & implementations for varied tasks on industrial knowledge, edge analytics and cloud providers.
Tim Wilson is an IoT Enablement Specialist with AWS’s Public Sector Companion group. On this function Tim works with AWS public sector companions to help their adoption and use of AWS IoT providers and options. He began at AWS as a Answer Architect in 2012 when AWS’s Public Sector enterprise was comparatively small. He has additionally held roles at AWS managing an IoT prototyping lab and as a technical presenter within the AWS Government Briefing Middle.



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments