Skip to content

AWS IoT MQTT Broker connection

Francois Normandin edited this page Apr 1, 2024 · 1 revision

Sorry for the French screenshots. I think it is self-explanatory.

1- Connect to your AWS account and select IoT Core. image

2- You will need your IoT endpoint on AWS: The URI for connection of your IoT nodes.

This looks something like this: a1bc2w7fur3ca1-ats.iot.us-east-1.amazonaws.com This URI is linked to your AWS account. You should be able to ping it from the command line. ping a1bc2w7fur3ca1-ats.iot.us-east-1.amazonaws.com (I modified my address, so don't bother to try this one, it leads to nowhere!)

3- Next, you need to Amazon Root Certificate, to authenticate the server. Download the PEM from this location: https://www.amazontrust.com/repository/

image

4- You will need your X.509 certificate and a private key. Follow the steps to create one automatically. Download the cert and private pem key.

5- Finally, you need to register a "Thing", get your Thing's ID (arn:aws:iot:...). Create a policy and attach it to your certificate. image

image

Download the key and cert:

image

image

You'll need a policy image

Now that you have all this information, you can connect easily with the MQTT Connection.

Wire everything like this snippet. You should use the TCP connection add-on and inject that connection into your MQTT Client code. image