Prerequisites
- Create an Axiom account.
- Create a dataset in Axiom where you send your data.
- Create an API token in Axiom with permissions to update the dataset you have created.
- Create an AWS account with permissions to create and manage IoT rules, Lambda functions, and IAM roles.
Create AWS Lambda function
Create a Lambda function with Python runtime and the following content. For more information, see the AWS documentation. The Lambda function acts as an intermediary to process data from AWS IoT and send it to Axiom.DATASET_NAME
is the name of the Axiom dataset where you want to send data.API_TOKEN
is the Axiom API token you have generated. For added security, store the API token in an environment variable.
This example uses Python for the Lambda function. To use another language, change the code above accordingly.
Create AWS IoT rule
Create an IoT rule with an SQL statement similar to the example below that matches the MQTT messages. For more information, see the AWS documentation.Check logs in Axiom
Use the AWS IoT Console, AWS CLI, or an MQTT client to publish messages to the topic that matches your rule. For example,iot/topic
.
In Axiom, go to the Datasets tab and select the dataset you specified in the Lambda function. You now see your logs from your IoT devices in Axiom.