Instructions for building and running demos.
The libraries in this SDK are not dependent on any operating systems. However, the demos for the libraries in this SDK are built and tested on a Linux platform. This SDK builds with CMake, a cross-platform build tool.
Prerequisites needed to run the demos.
libssl-dev
or openssl-devel
when installed through a package manager.Setting up AWS IoT to run demos.
It is required to setup an AWS account and access the AWS IoT Console for running demos and tests. Follow the links to:
Sign-in to the AWS IoT Console after setting up the AWS account.
Note: If using the Provisioning library, a fleet provisioning template, a provisioning claim, IoT policies and IAM policies need to be setup for the AWS account. Complete the steps to setup your device and AWS IoT account outlined here.*
Passing configuration settings to run the mutual auth demo.
demo_config.h
in demos/mqtt/mqtt_demo_mutual_auth/
to #define
the following:AWS_IOT_ENDPOINT
to your custom endpoint. This is found on the Settings page of the AWS IoT Console and has a format of ABCDEFG1234567.iot.us-east-2.amazonaws.com
.ROOT_CA_CERT_PATH
to the path of the root CA certificate downloaded when setting up the device certificate (or Provisioning Claim for Fleet Provisioning) in AWS IoT Account Setup.CLIENT_CERT_PATH
to the path of the client certificate downloaded when setting up the device certificate (or Provisioning Claim for Fleet Provisioning) in AWS IoT Account Setup.CLIENT_PRIVATE_KEY_PATH
to the path of the private key downloaded when setting up the device certificate (or Provisioning Claim for Fleet Provisioning) in AWS IoT Account Setup.How to build the demo applications on the command-line.
All demo executables can now be found in the build/bin
directory and should be run while inside that directory.
Alternative option of using Docker containers for running demos locally.
Install Docker:
The following instructions have been tested on an Ubuntu 18.04 environment with Docker and OpenSSL installed.
Download the official Docker image for Mosquitto.
BROKER_ENDPOINT
defined in demos/mqtt/mqtt_demo_basic_tls/demo_config.h
can now be set to localhost
.
For TLS communication with Mosquitto broker, server and CA credentials need to be created. Use OpenSSL commands to generate the credentials for the Mosquitto server.
Create a mosquitto.conf file to use port 8883 (for TLS communication) and providing path to the generated credentials.
Run the docker container from the local directory containing the generated credential and mosquitto.conf files.
ROOT_CA_CERT_PATH
to the absolute path of the CA certificate created in step 3. for the local Mosquitto server.