This lambda function code is triggered by AWS IoT rule to parse MQTT message payload sent by vehicle OBD logger, and write to timestream. Please refer to this guide on how to grant required permission for AWS IoT rule and this guide for lambda function.
MQTT topic for sending data is defined as follows:
data/<device_model>/<organization>/<device_id>
Vehicle logger management is done using AWS IoT Core Thing Registry.
Each logger is organized into vehicle_data_logger
thing type with the following searchable thing attributes:
device_id
(IMEI number)device_model
(manufacturer and device model)organization
(Organizatoin name)
When deployed to a vehicle, each logger is assigned the following non-searchable attributes to denote details of the vehicle of which the logger is deployed.
power_source
(power source used by the propulsion system of the vehicle)vehicle_id
(vehicle identification number)licence_plate
(licence plate number)vehicle_manufacturer
(manufacturer of the vehicle)vehicle_model
(model of the vehicle)vehicle_type
(vehicle type defined by local legislation body of which the vehicle is operating)location
(location of which the vehicle is registered and operated)
These ThingAttributes are used as Dimensions of the data points generated by the logger when writing to AWS Timestream database.