Template:AWSinstructions


Document Information

Glossary

  • Wiki – Teltonika IoT knowledge base - https://wiki.teltonika-iot-group.com/.
  • FOTA – Firmware Over The Air.
  • Configurator – Tool to configure Teltonika Telematics devices.
  • Crowd support forum – knowledge base dedicated for Troubleshooting.


For firmware supporting MQTT please contact your sales manager or contact directly via Teltonika Helpdesk.

Other software required to develop and debug applications for the device

For debugging situations, device internal logs can be downloaded OTA by using our FotaWEB platform or by using Teltonika Configurator.

Setup your AWS account and Permissions

Refer to the online AWS documentation at Set up your AWS Account. Follow the steps outlined in the sections below to create your account and a user and get started:


Pay special attention to the Notes.

Create Resources in AWS IoT

Refer to the online AWS documentation at Create AWS IoT Resources. Follow the steps outlined in these sections to provision resources for your device:


Pay special attention to the Notes.

Provide Device with credentials

Whole device, AWS IoT and testing information can be downloaded in PDF format here.

NOTE: MQTT will not work without uploaded TLS certificates.

AWS IoT Core Configuration

Setting up AWS IoT Core


When logged in the AWS console, click on Services on the top left hand side screen, to access IoT core.


Accessing IoT Core.jpg

Figure 1. Accessing AWS IoT core from AWS console

NOTE: If you can't see "Services" in the top left, click on "My account" in the top right and "AWS Management Console"


Select Manage, Security, Policies (Manage > Security > Policies) and press Create policy or Create buttons. Accessing policy creation.png

Figure 2. Accessing policy creation


In the Create Policy window, enter Policy name. In the Policy document tab for Policy Action (1) select “*” and for Policy resource (2) enter “*” and press create. Creating policy.png

Figure 3. Creating a policy


Now, that you have created a policy, select Manage on the sidebar on the left side, then select All devices, Things (Manage>All devices>Things). And click on Create things.
Go to create things.bmp

Figure 4. Accessing Things


Afterwards select Create single thing and click Next.
Creating thing.jpg

Figure 5. Creating single thing


After creating a single thing, enter Thing’s name and in the Device Shadow tab select Unnamed shadow (classic). Then click Next. Thing's properties.jpg

Figure 6. Thing's properties


Then when selecting Device certificate, select Auto-generate a new certificate and click Next. Certificate configuration.jpg

Figure 7. Certificate configuration


Now, select the policy you have created before to attach it to the certificate and thing. After that click Create thing. Attaching policy to certificate.jpg

Figure 8. Attaching policy to certificate


Then window with Certificate files and key files download options should pop out. It‘s recommended to download all files, because later some of them will not be available for download. The files that are required for usage with FMX devices are: Device certificate (1), private key(2), and Amazon Root CA 1 file(3), but it‘s recommended to download them all and store them in secured place.
Certificate and key download.jpg

Figure 9. Certificate and key download


Finding device data endpoint (server domain)

To receive server domain (in AWS endpoint) click on the side bar on the left Settings (AWS IoT->Settings). Or click on the side bar on left side Things, select the created thing, after it click Interact->View Settings. Whole path - (Things->*YourThingName*->Interact->ViewSettings). Page containing endpoint will open. Copy the whole endpoint address. Port for accessing this endpoint is 8883.
Device data endpoint.jpg

Figure 10. Device data endpoint

Merging certificates into a single file (FW Ver. 03.28.03.Rev.311)

Merger download: Media:Crt_MRGs.zip

NOTE: for FW Ver. 03.28.03.Rev.311 it is possible to upload a single merged file instead of 3 separate files. First, double click certificate merger to execute the program. Certificate merger.png

Figure 11. Certificate merger


Then, a screen will pop out asking to select a certificate. Go to the folder with your certificate, private key and root certificate. Select the certificate. Selecting certificate.png

Figure 12. Selecting certificate


Another screen will pop out asking to select private key, so select private key. Selecting private key.png

Figure 13. Selecting private key


Last screen will ask you to select the root certificate.
Selecting root certificate.png

Figure 14. Selecting root certificate


After selecting the root certificate your files will be merged and a new “Merged” folder will appear inside your certificate folder. Inside it will be the merged_cert.pem. Merged folder.png

Figure 15. Merged folder

Merged certificate.png

Figure 16. Merged file

Configuring the device

Security and certificates


Using certificate, private key and root certificate. (Via Cable)

Find Certificate file ending with extension pem.crt (ending may be just .pem) Private key file and AmazoonRootCA1 file (no need to change filenames). These files should have been downloaded when creating Thing in AWS IoT Core.
Certificate and key download.jpg

Figure 17. Certificate, private key and root certificate

Upload the mentioned files in the Security tab in the Teltonika Configurator.
Uploading certificates to configurator.png

Figure 18. Uploading certificates and keys


After uploading certificates, go to System tab and in Data protocol section select - Codec JSON.
Choosing data protocol.jpg

Figure 19. Choosing data protocol

Using FW Ver. 03.28.03.Rev.311 and merged_cert.pem file. (Via FOTA WEB)

NOTE: uploading merged certificate file is only possible using FW Ver. 03.28.03.Rev.311.
Open FOTA WEB and press devices side bar. Then select a device you want to upload merged certificate to and press create task. FOTA WEB Devices.png

Figure 20. Selecting device


A “Create task” window will pop up. Select task type “Transfer user TLS certificate”. Press “Upload new file” to upload your merged certificate. If you already have uploaded the merged certificate skip the next step.
Creating task.png

Figure 21. Creating task


“Upload file” window will pop up. Change file type to Certificate, choose your company, press select files, find the merged file you created in step 3 and double tap. Click “Upload” button. Another window may appear with uploaded file information, simply click “Close”.
Upload merged file.png

Figure 22. Uploading merged file


Now you should be back in “Create task” window. Select the certificate you have just created and press “Create”.
Selecting task certificate.png

Figure 23. Selecting certificate


Your task has been created and is now pending. Pending task.png

Figure 24. Pending task

To have the task completed send an SMS command to your device:

<SMS login><space><SMS password><space><web_connect>

If you have no login or password your message should look like this:

„ web_connect“

This is how the merged certificate should look in configurator after upload:
Uploaded and merger certificate.png

Figure 25. Uploaded merged certificate


After uploading certificates, go to System tab and in Data protocol section select - Codec JSON. Choosing data protocol.jpg

Figure 26. Choosing data protocol

Device GPRS configuration for AWS IoT Custom MQTT settings

In the GPRS tab, under Server Settings select:

  1. Domain – Endpoint from the AWS, Port: 8883
  2. Protocol – MQTT
  3. TLS Encryption – TLS/DTLS



In the MQTT Settings section select:

  1. MQTT Client Type – AWS IoT Custom
  2. Device ID – enter device IMEI (optional)
  3. Leave Data and Command Topics unchanged.



Save the configuration to the device.

AWS GPRS settings.png

Figure 27. GPRS Settings for MQTT AWS IoT

Checking received data and sending commands in the AWS IoT core

The data received from the device can be found in the MQTT test client, which can be found above “Manage” in the sidebar on the left. MQTT test client location.png

Figure 28. MQTT test client location


To see incoming data, subscribe to topic - *DeviceImei*/data . Or subscribe to # to see all incoming outgoing data in the Topics. MQTT test client.jpg

Figure 29. MQTT test client


Incoming data is received in JSON format, for e.g.:
Received data format.png

Figure 30. Received data format


To send SMS/GPRS commands to the device subscribe to a topic name - *DeviceIMEI*/commands, and, in the same MQTT test client window select Publish to a topic. Enter topic name - *DeviceIMEI*/commands. In the Message payload enter wanted GPRS/SMS command in following format and press Publish:

{“CMD”: “<Command>”}
Sending a command.jpg

Figure 31. Sending Command in AWS IoT Core


The response to the command will be shown in the Data topic: Response to command.jpg

Figure 32. Response to a command in the data topic, the command was published in command topic

Debugging

In the situation when the issue with information upload appears, device internal logs can be taken directly from device configuration software (instructions), via Terminal.exe by connecting selecting device USB connection port, or by receiving internal logs via FotaWEB in task section.

Troubleshooting

The information can be submitted to Teltonika HelpDesk and Teltonika engineers will assist with troubleshooting. For a more detailed information regarding what information should be collected for debugging, please visit the dedicated page on Teltonika Wiki.
Alternatively, Teltonika has a Crowd Support Forum dedicated for troubleshooting, where engineers are actively solving problems.