
How I built a satellite-based tracking app for the Tour du Mont Blanc
In this post I explore how a commercially available, off-the-shelf satellite communication device can be integrated with AWS services to create your very own serverless cloud-based tracking application!
- Amazon API Gateway - Provides a fully managed API management service that allows you to create, publish, maintain, monitor, and secure APIs. In this solution, API Gateway is used to provide the single point of interaction for Garmin's IPC Outbound interface and the front-end single page application (SPA).
- Amazon Cognito - Handles user authentication and authorisation for your web and mobile apps. In this solution, through its integration with API Gateway, Cognito is used to authenticate both a) front-end users of the SPA, and b) back-end API access by the Garmin IPC Outbound interface using the OAuth2 protocol.
- AWS Lambda - Provides a serverless compute service which executes your code in response to events. The solution uses a Lambda function to run code that forwards incoming data to other AWS services, namely AWS IoT Events and Timestream.
- Amazon Location Service - Adds location functionality, such as maps, points of interest, geocoding, routing, tracking, and geofencing, to your applications. In this solution, Location Service is simply used to deliver map tiles to the front-end SPA.
- AWS IoT Events - Helps monitor your equipment or device fleet for failures or changes in operation and starts necessary actions. In this solution, AWS IoT Events is used to track responsiveness and battery level of the device and is configured to notify a user of significant status changes by email.
- Amazon Timestream - Provides a fully managed, purpose-built time-series database engine. In this solution, Timestream is used to store incoming data from the devices alongside timestamps.
- AWS Amplify - Provides front-end libraries, UI components, and back-end building for fullstack applications on AWS. In this solution, Amplify is used to host the front-end SPA.
- The InReach Mini 2 device communicates with the satellite constellation and exchanges information. Out-of-the-box functionality is unaffected by this solution as no configuration changes are required on the device itself, other than enabling the tracking to take place at 10-minute intervals at the start of each day.
- In order to authenticate with API Gateway, Cognito's OAuth2 token endpoint is used by the Garmin Gateway IPC Outbound service to receive an access token. The client credentials grant type is used to retrieve an access token using a pre-generated client ID and secret. Cognito OAuth2 token endpoint details, client ID and secret, and API Gateway URL are all configured under the Outbound Settings of Garmin Explore's inReach Portal Connect configuration to complete this integration.Image not found
Enabling the Garmin IPC Outbound settings in Garmin Explore - At regular intervals, the Garmin Gateway IPC Outbound service submits the latest tracking information to the API Gateway endpoint using an HTTP
POST
request. As well as WGS84 coordinates, the payload contains additional information such as altitude, course, speed, GPS fix status and battery warning. The uniqueimei
key/value identifies the device. - Through a Lambda proxy function integrated with the API Gateway REST API, the data contained in the
POST
request is retrieved and committed to a Timestream table.Image not foundConfiguring API Gateway GET, POST and OPTIONS methods - Afterwards, the Lambda proxy function enters the data as an input into an AWS IoT Events detector model as a heart-beat. In this way, the detector model is able to conclude that the device is unresponsive if payloads have not been received for a particular device in the past hour. Another detector model will monitor the battery status (
lowBattery
key/value).Image not foundConfiguring an AWS IoT Events detector model for responsiveness - When authenticated users of the Vue.js 3 front-end single page application (SPA) request tracker details, these are returned as JSON payload by the API Gateway's HTTP
GET
method. - When receiving an HTTP
GET
request, tracker details are returned from the Timestream table by the Lambda proxy function. - To provide visitors an interactive map populated by tracker details, Location Service's Maps API is used. Tracker location markers and routes are placed across the map tiles using the
maplibre-gl-js-amplify
andmaplibre-gl
JavaScript libraries. In this example, I have used HERE as the data provider.Image not foundConfiguring HERE as the data provider for map tiles - In the event that there has been no data received from the Garmin IPC Outbound service, the AWS IoT Events detector model changes the state of the device to
Unresponsive
and sends out a notification to an email address via an Amazon Simple Notification Service (SNS) topic. Similarly, if the battery level is low, the state of the device is changed toLowBattery
and a notification is sent.Image not foundViewing an unresponsive device email
Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.