AWS IoT Device SDK C: Main
Return to main page ↑
Global Demo Configuration

Configuration settings that affect all demos.

Configuration settings are C pre-processor constants. They can be set with a #define in the config file (iot_config.h) or by using a compiler option such as -D in gcc. If a configuration setting is not defined, the library will use a "sensible" default value (unless otherwise noted). Because they are compile-time constants, a library must be rebuilt if a configuration setting is changed.

configpagemarker

IOT_DEMO_SECURED_CONNECTION

Determines if the demos default to a TLS-secured connection with the remote host.

When this setting is true, all demo applications will use a TLS-secured connection by default. The default credentials for connections are IOT_DEMO_ROOT_CA, IOT_DEMO_CLIENT_CERT, and IOT_DEMO_PRIVATE_KEY. Any connection with AWS IoT must be secured.

In demo applications, the default secured connection setting can be overridden using the command line options -s or -u. Neither of these command line options have an argument, and only one of the two should be used at a time. Passing -s will cause the demo application to use a secured connection, and passing -u will cause the demo application to use an unsecured connection.

Possible values: true (secured connection) or false (unsecured connection)
Recommended values: When using the demo applications with AWS IoT, connections must be secured. Therefore, the recommended value for this setting is true.
Default value (if undefined): If this setting is undefined and neither -s nor -u are passed as command line options, then any connections will be unsecured.

IOT_DEMO_SERVER

The default remote host to use in the demos.

All demo applications will open TCP connections to this host. When using the demos with AWS IoT, this should be set to the AWS account's custom IoT endpoint. This custom endpoint can be found under the Settings tab of the AWS IoT console. It has a format of ABCDEFG1234567.iot.us-east-2.amazonaws.com, where ABCDEFG1234567 is a placeholder subdomain and us-east-2 is the region.

In demo applications, the default server can be overridden using the command line option -h. The command line option will override this setting.

No default value is provided for this setting. If this setting is undefined and no command line option -h is given to the demo application, the demo will fail.

Possible values: Any string representing a hostname, such as

  • ABCDEFG1234567.iot.us-east-2.amazonaws.com
  • 192.168.1.1
  • localhost

IOT_DEMO_PORT

The default remote port to use in the demos.

All demo applications will open TCP connections to IOT_DEMO_SERVER on this port. When using the demos with AWS IoT, this should be set to either 443 or 8883. Port 8883 provides a standard encrypted MQTT connection, while port 443 provides a secured MQTT connection using ALPN.

In demo applications, the default server port may be overridden using the command line option -p. The command line option will override this setting.

No default value is provided for this setting. If this setting is undefined and no command line option -p is given to the demo application, the demo will fail.

Possible values: Any positive integer below 65536.
Recommended values: When using the demo applications with AWS IoT, port 443 is recommended.

IOT_DEMO_ROOT_CA

The path to the default trusted server root certificate to use in the demos.

A trusted server root certificate only needs to be set for secured connections. See this page for more information about AWS IoT server certificates.

In demo applications, the default trusted server root certificate can be overridden using the command line option -r. The command line option will override this setting.

No default value is provided for this setting. If this setting is undefined and no command line option -r is given to a demo application using a secured connection, the demo will fail.

Possible values: Any string representing a filesystem path to a PEM-encoded trusted server root certificate.
Recommended values: When using the demo applications with AWS IoT, one of these root certificates should be used.

IOT_DEMO_CLIENT_CERT

The path to the default client certificate to use in the demos.

A client certificate only needs to be set for secured connections. See this page for a tutorial on how to set up client certificates with AWS IoT.

In demo applications, the default client certificate can be overridden with the command line option -c. The command line option will override this setting.

No default value is provided for this setting. If this setting is undefined and no command line option -c is given to a demo application using a secured connection, the demo will fail.

Possible values: Any string representing a filesystem path to a PEM-encoded client certificate.

IOT_DEMO_PRIVATE_KEY

The path to the default client certificate private key to use in the demos.

A client certificate private key only needs to be set for secured connections. This private key must match the client certificate.

In demo applications, the default client certificate private key can be overridden with the command line option -k. The command line option will override this setting.

No default value is provided for this setting. If this setting is undefined and no command line option -k is given to a demo application using a secured connection, the demo will fail.

Possible values: Any string representing a filesystem path to a PEM-encoded private key matching the client certificate.

IOT_DEMO_IDENTIFIER

A string that identifies this client to the cloud.

Depending on the demo, this identifier is used for the client identifier (general MQTT demos) or the AWS IoT Thing Name (demos specific to AWS IoT).

In demo applications, the default identifier can be overridden with the command line option -i. The command line option will override this setting.

In the general MQTT demos, this identifier becomes the MQTT client identifier. No two clients may use the same identifier simultaneously. MQTT client identifiers may be subject to certain constraints; for example, servers are not obligated to accept client identifiers longer than 23 characters or client identifiers containing non-alphanumeric characters. If this setting is undefined and no command line option is provided at runtime, the MQTT demos may generate a unique client identifier for use.

In the demos specific to AWS IoT, this identifier becomes the Thing Name, which is used to manage devices in AWS IoT. See this page for more information. No default value is provided for Thing Names. For demos requiring a Thing Name (such as Shadow) this setting must be defined (or a command line option -i given to the demo application); otherwise, the demo will fail.

Possible values: Strings representing MQTT client identifiers or Thing Names.