Template:AWSinstructions
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:
NOTE – The examples in this document are intended only for dev environments. All devices in your production fleet must have credentials with privileges that authorize only intended actions on specific resources. The specific permission policies can vary for your use case. Identify the permission policies that best meet your business and security requirements. For more information, refer to Example policies and Security Best practices.
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.
Provision the Device with credentials
Whole device, AWS IoT and testing information can be downloaded in PDF format here.
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.
After accessing AWS IoT core, select Manage on the sidebar on the left side, then select Things (Manage- >Things). And click on Create things.
Afterwards for select Create single thing and click Next.
After creating single thing, enter Thing’s name and in the Device Shadow tab select Unnamed shadow (classic). Then click Next.
Then when selecting Device certificate, select Auto-generate a new certificate and click Next
After this select Create policy to create it and attach it to Certificate. In the Create Policy window, enter Policy name. In the Policy document (1) tab for Policy Action (2) select * and for Policy resource enter * .
After creating policy, return to Certificate tab (Seperate tab after pressing Create policy should‘ve popped out). Then select the created policy to attach it to the certificate and thing. After that click Create thing
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.
Finding device data endpoint (server domain)
To receive server domain (in AWS endpoint) click on the side bar on the left 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.
Configuring the device
Security and certificates
Find Certificate file ending with extension pem.crt Private key file and AmazoonRootCA1 file (no need to change filenames). These file should have been downloaded when creating Thing in AWS IoT Core.
Upload the mentioned files in the Security tab in the Teltonika Configurator.
After uploading certificates, go to System tab and in Data protocol section select - Codec JSON.
Device GPRS configuration for AWS IoT Custom MQTT settings
In the GPRS tab, under Server Settings select:
- Domain – Endpoint from the AWS, Port: 8883
- Protocol – MQTT
- TLS Encryption – TLS/DTLS
In the MQTT Settings section select:
- MQTT Client Type – AWS IoT Custom
- Device ID – enter device IMEI (optional)
- Leave Data and Command Topics unchanged.
Save the configuration to the device.
Run the demo
The data received from the device can be found in the MQTT test client, which can be found in the bottom of sidebar on the left. To see incoming data, subscribe to topic - *DeviceImei*/data . Or subscribe to # to see all incoming outgoing data in the Topics.
Incoming data is received in JSON format, for e.g.:
To send SMS/GPRS commands to the device, 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:
The response to the command will be shown in the Data topic: