To configure a Losant MQTT Integration to connect to AWS IoT Core, follow the steps below. These instructions are designed for a service-to-service integration, where you’d like Losant to receive data from, or publish data to, many different devices connected to AWS IoT Core through a single integration.
Step 1: Create AWS IoT Core Certificate
AWS IoT Core uses certificates to authenticate against the AWS IoT Core broker. This is the certificate we’ll eventually provide to Losant.
On the resulting modal, download the certificate, private key, and certificate authority files.
Step 2: Create an AWS IoT Core Policy
A policy, which we’ll eventually attach to the certificate, controls what a connection using the certificate is allowed to do.
The screenshot above is showing a policy with Allow * *
, which will allow this connection to do every action on every resource. This is acceptable for testing, but for production it’s highly recommended that you edit this policy to restrict the actions and resources to only what’s required.
Step 3: Attach the policy to the certificate
Navigate to the certificate you previously created and click the Attach Policy button. On the resulting modal, choose the policy you just created.
Step 4: Obtain your specific MQTT broker URL
Select the Connect one Device menu item and find your unique URL at the bottom of that page.
Step 4: Configure the Losant MQTT Integration
Enter your MQTT URL and optionally provide a client ID. If you leave the client ID field blank, Losant will generate a random one for you. As a best practice, we recommend providing a client ID so that you can easily identify activity coming from this integration.
Choose Certificate for the Authentication Method and provide the key, cert, and authority files you downloaded previously.
Lastly, select one or more MQTT topics you’d like to subscribe to. When messages are received on these topics, they will trigger corresponding workflows. If you’re publishing data from Losant to AWS IoT Core, those topics do not need to be entered here. When publishing data, you will provide the topic in the MQTT Output Node.
Once the integration is saved, you should see it successfully connect: