Repository navigation
AWS IOT Device Simulation
In order the test the cloud solution before deployment, one needs to test out various aspects and stimuli for a given use-case requirement.
AWS-IoT Framework provides a secure device level connectivity to the MQTT Broker in the Cloud.
There are missing pieces in the documentation of How to connect to the AWS IoT service. The way in which TLS is expected to operate or how one needs to use the keys is not clearly explained. Hence this leads to confusion. This document attempts to disambiguate the connectivity options.
One of the Important Missing links is that of the Root certificate root-cert.pem:
VeriSign-Class%203-Public-Primary-Certification-Authority-G5.pem
This is mandatory to provide the TLS security. So this needs to be downloaded in every IoT device that needs to be authenticated and talk to the AWS IoT Cloud.
In this document we proceed from creating a new Device to Actually simulating the connect to Cloud using mqtt-spy. Most of this document is inspired by the original AWS-IoT for Raspberry Pi article, however here the focus is on simulation rather than actual device operation.
If one visits the First time to the AWS IoT Page, here is how it looks like:

Select the Get Started option to Begin.
Click on the New Device
Enter the Name of the Device and Confirm.
Clicking on the Device itself bring open the Info Pane which contains specifics of the selected IoT device.
Click to actually create the device instance by Connecting a Device button.
First select the Choice as Embedded C to get the Generate Certificate Button to appear. The reason Embedded C is selected as it gives the needed configuration information in one place. Next click on the Generate Certificate Button.
Wait for the Security Key download screen to Appear. All the generated Keys need to stored in safe place. Typically these reside in the embedded MCU's Flash memory. For Simulation purpose we store them on the PC in a directory.
Make sure to Download the Root-Cert Needed for the TLS authentication along with the above files.
There should be 4 Files after this Namely:
-
VeriSign-Class 3-Public-Primary-Certification-Authority-G5.pem= Root Certificate of AWS IoT for TLS -
xxxxxxxxxx-certificate.pem= Client Certificate for TLS -
xxxxxxxxxx-private.pem.key= Client Private Key for TLS (Non-Encrypted) -
xxxxxxxxxx-public.pem.key= Client Public Key
In this we have the following Inputs:
-
AWS IoT Broker URI used by the Device to establish connection with the Cloud
-
AWS IoT Port its important to note this as its not the default one.
-
AWS IoT Key file names used for TLS encrypted communications
This info would later used to configure the mqtt-spy tool.
Now use the Earlier noted info about the Broker URI.
Make sure to Add the :8883 postfix to the Broker URI as AWS IoT Support different port number.
Also make sure that the Client ID is same as the Device name created.
Here after making the TLS selection as shown, all the important files needs to be mapped.
-
CA certificate file = Root CA =
VeriSign-Class 3-Public-Primary-Certification-Authority-G5.pem -
Client certificate File =
xxxxxxxxxx-certificate.pem -
Client key file =
xxxxxxxxxx-private.pem.key -
Client key password = though there is not password as mentioned in the key file still entering some thing else in the filed helps to keep the operation consistent.
-
Client key in PEM format = True
All materials are Licensed under the MIT Open source License unless otherwise specified.