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.Generating pre-signed URLs and passing configuration settings to run the S3 upload, download, and multi-threaded download demos.
The S3 upload, download, and multi-threaded download demos require user-generated pre-signed URLs to be configured. A python script presigned_url_gen.py
(located in demos/http/common/src/
) is provided to easily generate pre-signed PUT and GET URLs.
Install the dependencies.
Run presigned_url_gen.py with your S3 bucket-name, S3 object-key, and optionally, your S3 bucket's region-name (if not specified, the region configured in AWS CLI will be used).
An example expected output:
Copy and paste the output into demo_config.h for macro S3_PRESIGNED_GET_URL and S3_PRESIGNED_PUT_URL.
You may also pass any or all of the following configuration settings as command line options in order to run the demos:
Note: A pre-signed GET URL is required for all HTTP S3 demos. For upload demos, in addition to the GET URL, a pre-signed PUT URL is also required.
--bucket
: The name of the target S3 bucket used in the demos.--key
: The name of the existing object you wish to download (GET), or the name of the object you wish to upload (PUT).--region
: The name of the region in which your S3 bucket was created. If this is not passed in, the region configured in AWS CLI (or us-east-1, if not configured) will be used.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.