Adding AWS IoT Thing Parameters - KBA228420

Version 5

    Author: DheerajK_81          Version: **

    Question:
    The mbed-os-example-aws-iot-client code example requires the information of AWS parameters to be added to the configuration files as one of its key steps. How do I add these? 


    Answer:

    The mbed-os-example-aws-iot-client code example demonstrates the capabilities of PSoC 6 Wi-Fi BT Prototyping Kit to establish a connection with a cloud service provider such as Amazon Web Services (AWS) and be able to interact with an IoT Thing as a publisher or a subscriber.

     

    AWS IoT is one such service in the wide array of services offered as part of AWS to bring together data management and rich analytics in easy to use services designed specifically for IoT data.

     

    Register your device or IoT Thing by following this guide: https://docs.aws.amazon.com/iot/latest/developerguide/register-device.html

    To add these AWS parameters to the code example, navigate inside either the publisher or subscriber project directory and locate the file aws_config.h. It has the following fields:

     

    Figure 1

     

    Do the following to edit the fields:

     

    a) Obtain the AWS IoT Endpoint address by going to AWS IoT Console > Manage > Things, and then click on the Thing you created. Once the Thing is opened, click Interact on the side panel. 

     

    Figure 2

    Copy the endpoint address as highlighted in Figure 2 and replace it in the line containing #define for AWSIOT_ENDPOINT_ADDRESS.

     

    b) Change the #define for AWSIOT_THING_NAME to the name of your registered Thing. In this example, the Thing that is created is called “AWS_Thing”.

     

    c) If required, change AWSIOT_CLIENT_ID and AWSIOT_TOPIC. For this example, leave it as is.

     

    d) Add the certificate keys. The mapping of the keys to the respective fields is as follows:

      • SSL_CLIENTCERT_PEM  ----> Certificate for the Thing
      • SSL_CLIENTKEY_PEM ----> Private key
      • SSL_CA_PEM ----> AmazonRootCA1 certificate

     

    For example:

    Note: Add “\” in each line because it is a multi-line string. Also, you must add “\n” wherever there is a new line; for example, after “BEGIN CERTIFICATE” to maintain the format of the certificate.

     

    See the aws_config.h file attached with this article for reference.