How to integrate with AWS IOT Core Device Location

How to integrate with AWS IOT Core Device Location

AWS IoT Core Device Location is a service from AWS that allows you to estimate the location of your device using third-party solvers, eliminating the need for a GPS device. You can find more information in the documentation.



This guide will walk you through the process of integrating any device with the AWS IOT Core Device Location and TagoIO. By following the steps outlined below, you will be able to set up your device to get an estimated location.

1) AWS Setup
  1. Go to Identity and Access Management (IAM) on AWS.
  2. Create a policy with the access "Allow" to the service "iotwireless:GetPositionEstimate".
  3. Create a user for this policy.
  4. When a user is created, generate an access key for that user and copy the Access Key ID and Secret Access Key. For more information, refer to the AWS documentation: IAM users - AWS Identity and Access Management
2) TAGOIO Setup
  1. Configure 2 Secrets for AWS access
    - AWS_ACCESSKEYID - with the value of the Access Key ID.
    - AWS_SECRETACCESSKEY - with value of the Secret Access key.

  2. Import the Analysis template for integration with AWS IOT Core Device Location from this link or get the analysis code from our GitHub.

  3. Create the following environment variables for the analysis:
    - AWS_REGION - insert the valor of the region of AWS for user created on step 1
    - DESIREABLE_ACCURACY_PERCENT - insert the numeric valor of the desirable percentage of accuracy of the location divided by 100, default value is 0 (67% = 0.67).
    - GNSS_SOLVER_VARIABLE - name of the variable of GNSS Solver that will come on device data, default value is "gnss_solver".
    - IP_ADDRESS_VARIABLE - name of the variable of IP addresses that will come on device data, default value is "ip_addresses".
    - WIFI_ADDRESSES_VARIABLE - name of the variable of Wifi Mac and their RSS value that will come on device data, default value is "wifi_addresses". 

  4. Create an Action to trigger the Analysis based on variable of the device that will receive the data from estimated location

  5. Create a Policy for your analysis using the information provided below.
    - Policy name: it could be any name
    - Targets: Select Analysis with the field ID equal to the analysis you created. Simply choose it from the dropdown options.
    - Permissions: Add the following permissions:
    1. Allow Secrets with the rule Access with field ID equal to AWS_ACCESSKEYID secret.
    2. Allow Secrets with the rules Access with field ID equal to AWS_SECRETACCESSKEY secret.
    3. Allow Device with the rule Send Data with field ID equal to device that you want to get an estimated location. Simply choose it from the dropdown options.

3) Result


When the analysis is triggered, that analysis will write the following data on the device:

  1. {
  2.     variable: "estimated_location",
  3.     value: "lat;lng”,
  4.     location: {
  5.       lat,
  6.       lng,
  7.     },
  8.     metadata: {
  9.       horizontalAccuracy: horizontalAccuracy,
  10.       verticalAccuracy: verticalAccuracy,
  11.       color: "green" or "red", - based on DESIREABLE_ACCURACY_PERCENT
  12.     },
  13.     group: same of the device data received on analysis trigger
  14.     time: same of the device data received on analysis trigger
  15. }