Send a JSON Payload to AWS

Introduction

This documents how to send a DevEdge IoT Developer Kit JSON payload to an AWS API Resource / Gateway.

  1. Over T-Mobile's LTE-M Network.
  2. Over Wi-Fi.

Prerequisites

Some Important Things to Note

  • Ths instructions in this document were created using an Apple computer.

Configuration

Step A

  1. Create an AWS API base URL and endpoint. Please find instructions here to learn more.

  2. Save this endpoint and base URL for Step E.

  3. Also, make sure that the URL can accept a device ID wildcard at the end. So the syntax for the AWS API URL would be as follows: {baseURL}/{endpoint}/{deviceID}

Step B

Connect your board to your computer.

  1. Connect your IoT Developer Kit using the USB-A to USB-C cable provided to your computer like in the screenshot below. Ensure that the J-Link USB-C Debug port (port on the right) is plugged into your computer.

  2. Open your serial app on your computer. For demonstration purposes we will use Serial on a Mac.

  3. Select the serial port that is connected to your IoT Developer Kit then click Open.

  4. Under Terminal > Settings > Line Settings > Baud Rate make sure the following values are set then click OK:
    1. Baud Rate / Speed - 9600
    2. Data Rate - 8
    3. Parity - None
    4. Stop Bits - 1
    5. Flow Control - None

  5. At the command line screen press Enter on your keyboard. The uart command prompt appears. To learn more about uart, please read the document Interacting with the Kit at CLI via tmo_shell.

Step C

Download then install the appropriate certificates.

  1. Follow the instructions found in this document: Adding Certificates of Authority to Your Kit

  2. When you get to Step D search for Starfield certificates on your kit by using the tmo certs list Star command. Note that the search is case sensitive. If you use the command tmo certs list star it will not work.

  3. Find the index number for the Starfield Class 2 Certification Authority certificate. In the above case it is 045.

  4. Load the Starfield Class 2 Certification Authority certificate by issuing the following commands:

    tmo certs load 045
    tmo certs modem_load 045
    
  5. All other steps stay the same.

Step D

Send the JSON payload to AWS via Wi-Fi and the T-Mobile LTE network.

Wi-Fi

  1. In your serial app, check to make sure you are connected by entering tmo wifi status 2. If you are not connected to Wi-Fi enter tmo wifi connect 2 "SSID" 0 "PSK".

  2. Once connected to Wi-Fi enter the following commands into your serial app.

    tmo json base_url <Your-AWS-Base-URL>
    tmo json path <Your-AWS-Endpoint>
    tmo json iface 2
    tmo json settings
    
  3. Your serial app should look like the following:

  4. Enable the JSON payload to send by entering the following into your serial app: tmo json enable

  5. Once enabled look for a 200 OK message.


T-Mobile LTE

  1. Enter the following into your serial app.

    tmo json disable
    tmo wifi disconnect 2
    tmo json iface 1
    tmo json settings
    
  2. Your serial app should look like the following:

  3. Now we are going to be sending the JSON payload via the T-Mobile LTE Network / modem by entering tmo json enable.

  4. Once enabled look for a 200 OK message.

  5. Enter tmo json disable to stop sending to AWS.

Step E

Use Postman to check that the data was received at the specified AWS API base URL, path (endpoint), and device ID.

  1. Download the below Postman Collection.

    AWS-Test-Data-Postman-Collection.json

  2. Import the collection into Postman.

  3. In your serial app enter the following command: fs cat /tmo/aws_session.txt.

  4. Copy the 8-digit device ID number. Note that the device ID number is case sensitive.

  5. In your Postman app open the GET method then change the {{baseURL}}, {{endpoint}}, and {{deviceID}} to your 8-digit device ID number, endpoint, and base URL.

  6. Click Send. Check that the data that you sent from your serial app matches what the AWS API gateway received.

Troubleshooting

  • Question 1 - I am getting an errno: 116 error. Why could this be happening?

  • Answer 1 - Enter tmo certs info in your serial app. If the certificate is not Starfield Class 2 Certification Authority please search for the certificate by entering tmo certs list Star then using the tmo certs load <indexID> and tmo certs modem_load indexID> commands to install the Starfield cert.