The way to replicate AWS IoT SiteWise sources throughout environments

Spread the love


Introduction

As you scale your AWS IoT SiteWise purposes and transfer them into manufacturing, chances are you’ll contemplate adopting widespread CI/CD methodologies that separate growth and QA environments from manufacturing environments. This separation lets you automate the deployment of those purposes by deployment pipelines. You additionally might have a number of enterprise models and/or industrial websites with widespread asset fashions and hierarchies that you simply wish to share and reuse throughout your group. In these instances, clients sometimes 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 growth 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, Belongings, 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 note a pattern walkthrough of the right way to use AWS IoT SiteWise Instruments to export fashions adopted by an instance structure of the right way to 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 copy solely the sources you want on your particular use case. You’ll be able to select to solely export AWS IoT SiteWise asset fashions, or additionally export the corresponding property and AWS IoT SiteWise Monitor dashboards. The export software can be utilized manually from the command line (e.g. for a one-time export of an asset mannequin into one other atmosphere) or might 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 identical account. The AWS IoT SiteWise Instruments repository has detailed documentation on the right way to 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 need to export fashions from and run the command with no different flags (for those who additionally need to export property 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 will probably 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",
    "Sources": {
        "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 have got an understanding how the export utility works. Within the subsequent part we’ll present an instance structure that exhibits how one can combine the utilities into your CI/CD automation pipelines.

Instance CI/CD Structure

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

Construct

For the construct stage of the structure, the CI/CD pipeline initiates a Step Perform workflow within the supply atmosphere which executes three Lambda capabilities, one for every useful resource sort – asset fashions, property, and dashboards. The Lambda capabilities might 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 perform will then retailer the generated recordsdata in an Amazon S3 bucket to be used in the course of the deploy stage of the pipeline. For the S3 bucket, you may both use a standard shared bucket throughout all your AWS environments or use S3 replication to robotically copy the recordsdata between separate buckets in every atmosphere.

Deploy

Within the deploy stage, the AWS IoT SiteWise sources have to be created or modified in a selected order within the goal atmosphere, particularly, asset fashions, property, and dashboards. To do that, AWS StepFunction workflow states are outlined for every useful resource sort and the workflow is configured to execute them within the correct order. Every workflow state will use Lambda perform duties that reference the corresponding CloudFormation template in S3. The sources first have to be created by the CI/CD pipeline, due to this fact 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 watch for 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 should be created beforehand within the goal atmosphere.

Conclusion

On this weblog publish 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 with regards 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. You probably have one thing to contribute again to the repository, be at liberty to submit a pull request within the repository for evaluation.

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 several vertical like IIoT, Automotive, O&G, Sensible Dwelling, Sensible Metropolis and Mining in addition to information warehousing and massive information platform. Within the newest years he acquired focus in the right way to carry AI to IoT by 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 companies specializing in Large Knowledge Analytics & business 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 resolution architectures, designs & implementations for numerous initiatives on industrial information, edge analytics and cloud companies.
Tim Wilson is an IoT Enablement Specialist with AWS’s Public Sector Associate group. On this function Tim works with AWS public sector companions to help their adoption and use of AWS IoT companies 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 Govt Briefing Middle.

Leave a Reply

Your email address will not be published. Required fields are marked *