5.3 C
New York
Saturday, March 2, 2024

The right way to enhance machine discoverability by unlocking 50 AWS IoT factor sort attributes


Introduction

In case you are utilizing or planning to make use of AWS IoT Core to handle your fleet of Web of Issues (IoT) gadgets and questioning seek for and uncover a selected machine or a set of gadgets based mostly on their identities and capabilities, then utilizing attributes for AWS IoT factor varieties is likely one of the really helpful methods to make machine discovery simpler.

A ‘factor’ is the logical identify for entities just like the IoT-enabled gadgets in AWS IoT Core. Whereas provisioning a factor, you’ll be able to connect searchable attributes to allow simpler identification and looking out throughout the AWS IoT registry.

Why would somebody need to search issues from the AWS IoT registry? To reply that query, let’s take the use case of linked lights the place a Lighting-as-a-Service supplier (LaaS) or their prospects (by means of self-service portals) want to find out from their lighting put in base, what number of are of a selected product-type, model-number, wattage, luminosity, shade, and manufacturing batch.

AWS IoT Core restricts attaching solely 3 searchable attributes to a factor, and this will not be sufficient if it’s good to uncover gadgets based mostly on extra attributes. On this weblog publish, we are going to present mitigate this problem utilizing a mixture of AWS IoT Core factor varieties and AWS IoT Machine Administration fleet indexing.

With fleet indexing, fleet directors can manage, examine, and troubleshoot fleet of gadgets. They will question a bunch of gadgets, and combination statistics on machine data which might be based mostly on completely different combos of machine attributes, together with state, connectivity, and machine violations. For instance, you’ll be able to question info, resembling what number of gentle bulbs of a sure mannequin put in at a sure location are presently disconnected and are working the older model of firmware.

Conditions

This weblog publish requires a fundamental understanding of the machine provisioning function of AWS IoT Core and the fleet indexing function of AWS IoT Machine Administration.

Walkthrough

Let’s now see add a non-searchable attribute to a factor and use fleet indexing for search even whereas utilizing non-searchable attributes.

Let’s provision a factor ‘MyFirstThing’ and fix searchable attributes to it. As you’ll be able to see within the following snapshot, you’ll be able to solely connect 3 searchable attributes.

Provision a thing with 3 attributes

So as to add extra attributes to this factor, you’ll be able to connect a ‘factor sort’ to the factor.

‘Factor sort’ permits you to retailer description and configuration info that’s frequent to all issues related to the identical factor sort. This simplifies the administration of issues within the registry. For instance, as a substitute of assigning attributes to every gentle bulb individually, you’ll be able to create a factor sort referred to as ‘LightBulb’ and affiliate attributes of a lightweight bulb like serial quantity, luminosity, wattage, and extra. Furthermore, if you happen to change the factor sort of the present factor to ‘LightBulb,’ it will inherit the attributes of the factor sort and you might specify values for every of the attributes outlined within the ‘factor sort.’

Although assigning a factor sort to a factor is an optionally available exercise, its utilization unlocks a brand new part of 47 extra ‘non-searchable factor attributes.’ With this affiliation, you now have entry to a complete of fifty attributes as highlighted within the following snapshot.

Attach a thing type to a thing

For this publish, now we have already created a factor sort ‘LightBulb’ with searchable attributes, resembling producer, serial quantity, and wattage, and assigned it to ‘MyFirstThing.’ We have now additionally connected 3 non-searchable attributes (shade, firmware sort, luminosity) as you’ll be able to see within the following snapshot.

View searchable and non-searchable attributes

Now, let’s attempt to search issues utilizing the ‘checklist issues’ command from the AWS CLI. We are able to see that looking out with ‘searchable’ attributes, the command returns the matching factor ‘LightBulb_1’.

aws iot list-things --attribute-name "wattage" --attribute-value '40'

{

    "issues": [

        {

            "thingName": "LightBulb_1",

            "thingTypeName": "LightBulb",

            "thingArn": "arn:aws:iot:ap-south-1:************:thing/LightBulb_1",

            "attributes": {

                "Color": "White",

                "Firmware_Type_Version": "Smart_LED.1.0",

                "Luminosity": "100",

                "manufacturer": "xyz_corp",

                "serialnumber": "123",

                "wattage": "40"

            },

            "version": 5

        }

    ]

}

Nevertheless, looking out with ‘non-searchable’ attributes, the command returns nothing because the attributes added by means of factor sort are labeled as non-searchable.

aws iot list-things --attribute-name "Colour" --attribute-value 'White'


{
    "issues": []
}

That is the place the AWS IoT Machine Administration fleet indexing function helps, enabling you to run search queries even on ‘non-searchable’ factor attributes.

With AWS IoT Machine Administration fleet indexing, you’ll be able to index, search, and combination your machine information from the next sources: AWS IoT registry, AWS IoT Machine Shadow, AWS IoT connectivity, and AWS IoT Machine Defender violations.

Whereas the fleet Indexing function has the aforementioned as its major capabilities, for this weblog publish we are going to focus solely on indexing and looking out based mostly on factor sort attributes.

Now, let’s allow fleet indexing (skip this step if already enabled) utilizing AWS IoT console, however it may also be enabled from the CLI. Choose Settings from the left panel and scroll all the way down to Fleet indexing and choose Handle indexing as proven following:

Fleet indexing view

On the Handle fleet indexing display, toggle the change to activate fleet indexing as proven following and choose Replace on the backside of display to save lots of settings.

Activate fleet indexing

Different test containers proven on the earlier display enable indexing and search queries based mostly on machine shadows, connectivity standing, and Machine Defender violations that are out of the scope of this publish and therefore are usually not chosen right here.

After fleet indexing is enabled, choose Superior search from the AWS IoT Handle Issues console as proven within the following snapshot.

Advanced search screen

Utilizing the search field, seek for non-searchable attributes, for instance, ‘shade’ having worth ‘white’ and you will note that the issues with the matching attribute worth will seem because the search outcome on the backside of the display as proven following.

View Search Results

You too can use AWS CLI to run the same fleet index question for gadgets with non-searchable attribute ‘shade’ having worth ‘white,’ whereby factor(s) with matching attribute values are returned, as indicated following.

aws iot search-index –query-string ‘attributes.shade=White’


{
    "issues": [
        {
            "thingName": "LightBulb_1",
            "thingId": "******************************",
            "thingTypeName": "LightBulb",
            "attributes": {
                "Color": "White",
                "Firmware_Type_Version": "Smart_LED.1.0",
                "Luminosity": "100",
                "manufacturer": "xyz_corp",
                "serialnumber": "123",
                "wattage": "40"
            }
        }
    ]
}

Nevertheless, it is usually necessary to notice that AWS IoT Machine Administration fleet indexing is meant for administrative functions, permitting directors to arrange, examine, and troubleshoot fleets of gadgets and needs to be used for such actions solely.

Fleet indexing and search options are metered by the variety of index updates and search queries executed. Discuss with the pricing web page for additional particulars and likewise refer its limits and quotas right here.

Conclusion

On this publish, I’ve proven you improve machine discoverability utilizing AWS IoT factor varieties and AWS IoT Machine Administration fleet indexing. Factor varieties allow you to connect extra attributes (non-searchable) to issues, and regardless of these attributes being non-searchable, you should use the fleet indexing function to go looking based mostly on non-searchable attributes, enabling you to conveniently filter and discover these gadgets out of your giant fleet of IoT gadgets.

For extra AWS IoT Core studying sources, please go to the web site.

Ankush Sharma

Ankush Sharma

Ankush Sharma is a Answer Architect at AWS India Personal Restricted, based mostly in Delhi, India. He’s a part of Enterprise Greenfield crew and helps prospects migrate, design and function safe and scalable options on AWS utilizing breadth and depth of AWS companies to ship anticipated enterprise final result. Ankush has over 17 years of expertise within the IT trade and when not at work he enjoys spending time together with his household and studying books.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles