The Internet of Things on AWS – Official Blog
Get Started with Fleet Hub for AWS IoT Device Management
There are billions of devices in homes, factories, oil wells, hospitals, cars, and thousands of other places–which means there are billions of devices to monitor and manage. AWS IoT helps customers in all industries effectively manage their device fleets, and can reliably scale to billions of devices and trillions of messages. Companies often rely on many different stakeholders, from developers to admin staff, to manage and monitor their IoT device fleets. To do so, these organizations build, deploy and administer their own custom platforms for non-technical users to interact with. While this helps manage fleet behavior and take corrective action, like troubleshooting an offline device or deploying an update before a device becomes non-compliant, these homegrown solutions require dedicated and often increasing levels of maintenance over time. This is especially true as an organization scales and adds more products to their connected device portfolio, which can result in engineering resources and time being pulled away from other higher impact priorities or innovation opportunities.
Fleet Hub for AWS IoT Device Management Overview
Fleet Hub for AWS IoT Device Management is a fully managed web application that allows non-technical stakeholders to easily view and interact with your device fleets. Getting started is also quick, as web applications created through Fleet Hub can be deployed in minutes, without any code, and integrate with existing enterprise protocols to meet security requirements. Once deployed, you can monitor fleet and device health, be alerted to unusual behavior through rule-based alarms, and use built-in integrations with other AWS IoT Device Management features and AWS IoT services to further troubleshoot an identified issue or take corrective actions.
Non-AWS account users can now access Fleet Hub for AWS IoT Device Management to monitor device fleets in near-real time, set alarms to notify technicians about unusual behaviors, and take corrective actions in response to alarms—all via a single sign-on portal that is controlled by the AWS account holder.
In this blog, we will walk through how to set up and deploy a Fleet Hub web application. In this example, Fleet Hub will manage battery operated trackers used to monitor the health and safety of the elderly. We will show how the AWS account administrator can set up a single sign-on portal, add users, and use device attributes to configure alert types for filters.
Assisted living use case for Fleet Hub
IoT connected device fleets come in all shapes and sizes and can be used for a variety of applications; this blog specifically uses the example of an assisted living monitoring use case. As health outcomes globally improve, people are living longer. As they do, elderly populations are seeking enriched, healthy, and independent lives. IoT applications like assisted living monitoring make this possible by placing various types of sensors around the home of the elder person, allowing them personal freedom whilst providing remote monitoring to ensure their safety. In this specific example, we will be using GPS trackers with mobile communication connectivity, which must be battery powered to allow freedom of movement. Maintaining battery levels, including proactive notifications (such as a charging notification when battery state is low), is imperative. For a care assistant (like in an assisted living home), utilizing battery-powered monitoring devices also mitigates the need to know the type of electronics required to power devices (e.g. the entire fleet has the same power requirements).
Prerequisites
In order to start using Fleet Hub you first need the following artifacts operating in your AWS account:
- If you do not have an AWS account, you will need to create and activate an AWS account first and set up both AWS IoT Core and AWS IoT Device Management. For getting started instructions, please view the AWS IoT Core getting started guide and the guide for how to manage devices with AWS IoT.
- Turn on AWS IoT Core fleet indexing, which is required for use with Fleet Hub https://docs.aws.amazon.com/iot/latest/developerguide/iot-indexing.html
- Devices that are able to deploy shadows using the AWS IoT Device SDK or in custom code that can read subscribed topic data. This is because fleet index needs to be able to pull metrics from assets on devices that will change in order to evaluate them. Discover qualified hardware that works with AWS services to help build and deliver successful IoT solutions in the AWS Partner Device Catalog.
Solution Overview: How managing devices with Fleet Hub works
The following diagram, Figure 1, shows an architecture of an array of devices connecting through AWS IoT Core via MQTT. Fleet Hub monitors these devices for specific attributes that are designated as important. To do this, Fleet Indexing is turned on for the AWS account so that thing aggregates can be created.
The AWS administrator can then create web applications for non-technical staff that allow them access to the device group, which the staff can use to monitor devices and create their own alarms (like for issues in the home or assisted living facility). These web applications can be made granular so that specific account holders, such as care assistants, can access only their approved devices to manage and control. With Fleet Hub, the users (such as the care assistant or approved family members) can create their own alarms and choose to be alerted by Email or text message via Amazon Simple Notification Service (SNS).
In this blog, we will walk through the procedures to set up and deploy Fleet Hub so it can be used for a similar workload.
To do this, we need to create a web application and aggregate fleet metrics. This can be accomplished through the following procedures:
- Step 1: Turn on Fleet Indexing
- Step 2: Find specific device attributes to monitor
- Step 3: Set custom fields
- Step 4: Set up Fleet Hub user portal
- Step 5: Turn on single sign-on
- Step 6: Set up alarms
Turn on Fleet Indexing
When it comes to monitoring a large number of devices, it can be hard to analyze specific trends and issues. For instance, if there is device failure, it can be difficult to determine whether that is due to the battery, firmware, movement out of range, or something more sinister.
With Fleet Hub, the administrator of the AWS account can turn on Fleet Indexing to monitor their devices, aggregate connection metrics, run queries to drill down and filter, list device details, and set up alarms.
Fleet Indexing creates an index of the messages coming in from your things and also indexes on connectivity, errors, and any shadow attributes that you’ve set up. To understand how to get measurable metrics into Fleet Hub, we first need to turn on Fleet Indexing in the AWS account. If you already have this turned on, then you can proceed to the next section. Fleet indexing is required to use Fleet Hub.
To turn on Fleet Indexing:
- Open the AWS IoT console, and navigate to Settings
- Select Enable Fleet Indexing
Select the specific device shadow attributes to monitor
The next step is to select specific attributes you plan to monitor. In this example, we are using AWS IoT Core shadow attributes from the GPS tracking device. If you have already coded shadow attributes for your device, you can open your thing in the AWS IoT Core console and select Shadows to see your device shadows. If you have not already added shadow attributes, you can add shadow and service attributes using the instructions in this doc. Note, after creating device shadows you will need to do a device firmware update. Use your shadows to view the attributes you want to monitor through Fleet Hub (such as battery state, firmware version, etc.).
The below demonstrates what a shadow state should look like for battery state in Fleet Hub as an example.
- Where “batt_state” represents 12% battery
- Movement = 1 (moving) 0 (not moving)
- Firmware = (current state of the device in software
For the battery, what we are looking for is if state goes below XX% (in this example, 12) we can create a report / send alerts. Looking at the shadow example, the device is reporting its current state out 100. 12 represents 12% of battery.
“reported”: {
“batt_state”: “12”,
“movement”: 1,
“firmware”: “2.23r2”
}
}
Figure 3: Shadow of the GPS tracker
Your device may have numerous shadow attributes that can be used from location in lat/long, movement in G/Nm or orientation of the device. Once you have selected these attributes, you can use them to set custom fields.
Set custom fields
To set these attributes as custom fields:
- Open the AWS IoT console
- Navigate to Settings, and then to Set custom fields
- Select Set custom fields and add the attributes you want to monitor (as shown in Figure 4)
- 4. Select Add custom field
- Confirm your field name
- Select your field type
- [Optional] Click Add another (and repeat above) to add as many fields as you need
Using device shadow updates in this way is really useful because you can set these attributes once for a device class/software version and then all of your devices with these attributes will report this state since Fleet Indexing validates updates from a shadow state. Knowing these states is powerful and adds another dimension to the data from devices. You can also validate updates with thing attributes for things that don’t have a shadow state by defining a set of attributes for a device and then updating these attributes using update-thing as part of the CLI. See the AWS Documentation for more details.
Set up the Fleet Hub user portal
Fleet Hub allows the AWS account administrator to set up all the resources, such as things and certificates, needed to create one or more web applications that provide transparency into the specific devices that non-technical users need to monitor and report on. In the use case of monitoring the elderly, key workers must periodically and remotely check in on their patients to ensure activity levels are in an acceptable (and expected) range. Additionally, this situation requires definition of movement parameters to ensure the trackers are functioning properly—which will be captured as the battery status from the AWS IoT Device Shadow service outlined in the second step.
From an AWS administration perspective, setting up Fleet Hub is easy to do–after the device shadows are selected, you can set up Fleet Hub user portal in less than 5 minutes.
To create the Fleet Hub user portal:
- Navigate to the AWS IoT Core console
- Select Fleet Hub in the menu option
- Select Get Started
- Select Create Application. In this screen, you can define indexing and users of the portal (see Figure 5)
Enable single sign-on for Fleet Hub
Setting up AWS Single Sign-On (SSO) provides access to specific users that are external to the AWS account, such as a care assistant. In the SSO portal, you can also define the indexing parameters which are important for users to be able to view and search with Fleet Hub.
To set up single sign-on for Fleet Hub:
- Visit the AWS SSO Getting Started page to learn how to set up single sign-on for your account, or navigate to the Fleet Hub Application settings in the Fleet Hub console and Select set up
- From the Fleet Hub Application settings page, validate that the custom search fields you added in the previous step are correct. If so, choose next
- Add the federate user role. If you don’t have one, click create new service role
- Add the name of your Fleet Hub instance and any details for it, such as ownership or project information
The next step is to add users to the account so they can log in. You will need to go through the steps of adding the users along with their email address. To do this:
- Open the SSO service and select Users on the left
- Select Add user
- Navigate back to Fleet Hub in the AWS IoT console
- Choose your users, and select Add
Once complete, the Fleet Hub environment is created in SSO (takes a few minutes to build). The SSO service will send the selected users an email invitation to join the Fleet Hub application. Upon following the email instructions, they will be able to log in and use the Fleet Hub service via SSO. Figure 7 shows the Fleet Hub dashboard where users can see the devices and their attributes.
Set up alarms
With Fleet Hub, you can set up alarms to notify technicians about unusual behavior. Once all the devices are available in the Fleet Hub dashboard, users can then create alarms. Fleet Hub allows a standard user to create alarms that can be used to track a single device or a fleet. In our case, this means tracking an individual person (who is perhaps, living independently) or group of people (who reside in an assisted living facility). In our example, we set an alarm that is initiated when battery level has gone below a certain threshold (as shown in Figure 8) to notify users (such as an elderly person living alone or a nurse) using an SNS action.
To set up the alarms:
- From the Fleet Hub dashboard, select Create alarm
- The drop-down list will include your custom attributes alongside the standard ones
- Select an aggregation type
- There are a few options depending on what attributes you want to monitor, such as maximum/minimum counts, sum, average. These can help you understand if devices are missing or when devices dip below a certain threshold.
- Choose a monitor period (such as every 5 minutes)
- Select next to go to the alarm trigger state (such as greater than/equal to/lower than)
- For example, for your battery state, you could say is greater than 90% battery or is equal/lower than 10% battery)
- Select the trigger point, whether that be greater than or less than the value in the percentile
- [Optional] Select next and fill out the email address or email list for who you want the alarm to go to and name the alarm state
Once you’ve completed these steps, your alarms are visible in the Fleet Hub alarms screen in the dashboard (as shown in Figure 8) as well as via email.
Clean Up
To avoid incurring future charges, delete all resources that you have created.
The SSO portal Fleet Hub application can be deleted by first navigating to Fleet Hub in the AWS IoT console and then selecting applications. Select your application and choose delete.
Fleet indexing can be turned off by navigating to the AWS IoT Core console, selecting Settings, then navigating to Manage fleet Indexing and then Thing indexing and group indexing.
Summary
With Fleet Hub for AWS IoT Device Management, you can quickly and easily build no-code, standalone web applications to monitor the health of your device fleets, such as for our use case of a fleet of battery-operated trackers used to monitor the elderly. Once Fleet Hub is set up, it can be used to manage common fleet-wide tasks such as restarting devices, updating firmware, rotating expired certificates, and investigating and remediating operational and security issues. This helps make it easier and faster for customers to manage their connected device fleets, freeing up valuable time and ensuring they can provide a reliable, secure, and high-quality end user experience.
Resources
This feature is now generally available in Fleet Hub is now generally available in US East (N. Virginia), US East (Ohio), US West (Oregon), Asia Pacific (Seoul), Asia Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Tokyo), Canada (Central), Europe (Frankfurt), Europe (Ireland), and Europe (London). Note, you will be able to access devices in any AWS Region by enabling Fleet Indexing for that Region. To learn how you can easily deploy a Fleet Hub application to monitor and interact with your device fleets, read the Fleet Hub documentation. To learn more, visit the AWS IoT Device Management website.
About the author
Andrew Delamare is a Senior Specialist Solution Architect for AWS IoT, based in London. Andrew works with many companies in different sectors, looking to leverage data from their physical assets to gain better insights in their operations and make it measurable.