Introduction
In case you are utilizing or planning to make use of AWS IoT Core to handle your fleet of Web of Issues (IoT) units and questioning how one can seek for and uncover a specific system or a set of units primarily based on their identities and capabilities, then utilizing attributes for AWS IoT factor sorts is without doubt one of the advisable methods to make system discovery simpler.
A ‘factor’ is the logical title for entities just like the IoT-enabled units in AWS IoT Core. Whereas provisioning a factor, you possibly can 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 clients (by means of self-service portals) want to find out from their lighting put in base, what number of are of a specific product-type, model-number, wattage, luminosity, coloration, and manufacturing batch.
AWS IoT Core restricts attaching solely 3 searchable attributes to a factor, and this might not be sufficient if that you must uncover units primarily based on further attributes. On this weblog publish, we are going to present how one can mitigate this problem utilizing a mixture of AWS IoT Core factor sorts and AWS IoT System Administration fleet indexing.
With fleet indexing, fleet directors can arrange, examine, and troubleshoot fleet of units. They’ll question a bunch of units, and mixture statistics on system data which might be primarily based on totally different mixtures of system attributes, together with state, connectivity, and system violations. For instance, you possibly can question data, equivalent to what number of mild bulbs of a sure mannequin put in at a sure location are presently disconnected and are working the older model of firmware.
Stipulations
This weblog publish requires a fundamental understanding of the system provisioning function of AWS IoT Core and the fleet indexing function of AWS IoT System Administration.
Walkthrough
Let’s now see how one can add a non-searchable attribute to a factor and how one can use fleet indexing for search even whereas utilizing non-searchable attributes.
Let’s provision a factor ‘MyFirstThing’ and fasten searchable attributes to it. As you possibly can see within the following snapshot, you possibly can solely connect 3 searchable attributes.
So as to add extra attributes to this factor, you possibly can connect a ‘factor kind’ to the factor.
‘Factor kind’ lets you retailer description and configuration data that’s widespread to all issues related to the identical factor kind. This simplifies the administration of issues within the registry. For instance, as an alternative of assigning attributes to every mild bulb individually, you possibly can create a factor kind known as ‘LightBulb’ and affiliate attributes of a light-weight bulb like serial quantity, luminosity, wattage, and extra. Furthermore, in case you change the factor kind of the present factor to ‘LightBulb,’ it might inherit the attributes of the factor kind and you can specify values for every of the attributes outlined within the ‘factor kind.’
Although assigning a factor kind to a factor is an non-compulsory exercise, its utilization unlocks a brand new part of 47 further ‘non-searchable factor attributes.’ With this affiliation, you now have entry to a complete of fifty attributes as highlighted within the following snapshot.
For this publish, we’ve already created a factor kind ‘LightBulb’ with searchable attributes, equivalent to producer, serial quantity, and wattage, and assigned it to ‘MyFirstThing.’ We’ve additionally hooked up 3 non-searchable attributes (coloration, firmware kind, luminosity) as you possibly can see within the following snapshot.
Now, let’s attempt to search issues utilizing the ‘checklist issues’ command from the AWS CLI. We will 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 kind are categorised as non-searchable.
aws iot list-things --attribute-name "Colour" --attribute-value 'White'
{
"issues": []
}
That is the place the AWS IoT System Administration fleet indexing function helps, enabling you to run search queries even on ‘non-searchable’ factor attributes.
With AWS IoT System Administration fleet indexing, you possibly can index, search, and mixture your system information from the next sources: AWS IoT registry, AWS IoT System Shadow, AWS IoT connectivity, and AWS IoT System 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 primarily based on factor kind attributes.
Now, let’s allow fleet indexing (skip this step if already enabled) utilizing AWS IoT console, but it surely can be enabled from the CLI. Choose Settings from the left panel and scroll right down to Fleet indexing and choose Handle indexing as proven following:
On the Handle fleet indexing display screen, toggle the swap to activate fleet indexing as proven following and choose Replace on the backside of display screen to save lots of settings.
Different verify containers proven on the earlier display screen permit indexing and search queries primarily based on system shadows, connectivity standing, and System Defender violations that are out of the scope of this publish and therefore should 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.
Utilizing the search field, seek for non-searchable attributes, for instance, ‘coloration’ having worth ‘white’ and you will notice that the issues with the matching attribute worth will seem because the search outcome on the backside of the display screen as proven following.
You can too use AWS CLI to run the same fleet index question for units with non-searchable attribute ‘coloration’ having worth ‘white,’ whereby factor(s) with matching attribute values are returned, as indicated following.
aws iot search-index –query-string ‘attributes.coloration=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’s also vital to notice that AWS IoT System Administration fleet indexing is meant for administrative functions, permitting directors to prepare, examine, and troubleshoot fleets of units and must be used for such actions solely.
Fleet indexing and search options are metered by the variety of index updates and search queries executed. Seek advice from the pricing web page for additional particulars and likewise refer its limits and quotas right here.
Conclusion
On this publish, I’ve proven you how one can improve system discoverability utilizing AWS IoT factor sorts and AWS IoT System Administration fleet indexing. Factor sorts allow you to connect further attributes (non-searchable) to issues, and regardless of these attributes being non-searchable, you need to use the fleet indexing function to look primarily based on non-searchable attributes, enabling you to conveniently filter and discover these units out of your giant fleet of IoT units.
For extra AWS IoT Core studying assets, please go to the web site.