AWS IoT Core is the Amazon Web Services platform that connects IoT devices to the AWS cloud over MQTT. The Weble IoT Universal Gateway Amazon AWS IoT Cloud driver connects the box to AWS IoT Core as one thing, with an X.509 client certificate: it publishes gateway values on MQTT topics and receives the messages published on the topics it subscribes to.
%aws:<topic> publishes the value on that topic. Typical use: route meter or HVAC values to AWS (rules, IoT Analytics, Timestream…).Driver key:
awsiot— listed as Amazon AWS IoT Cloud under IoT in Gateway driver. Licence: required, contact support@weble.ch. Platforms: Linux and Windows.
In the AWS IoT console:
…-certificate.pem.crt), the private key (…-private.pem.key) and the Amazon root CA (Amazon Root CA 1, AmazonRootCA1.pem). The private key can be downloaded only once.iot:Connect with the client ID used by the box, and iot:Publish, iot:Subscribe and iot:Receive on the topics you will use.xxxxxxxxxxxxxx-ats.iot.<region>.amazonaws.com.On the box:
eu-central-1) and, if your policy restricts the client ID, Client ID.%aws: prefix, for example building1/room1/temperature, and choose the datatype (number, string or json).building1/#.
Name, Cluster ID and Description are common to all drivers: see Gateways.
| Label | JSON key | Default | Description |
|---|---|---|---|
| Client ID | json.clientId |
sdk-nodejs-<random> |
MQTT client identifier. The form proposes a random one. It must be unique: two connections with the same client ID disconnect each other. If your policy allows only ${iot:Connection.Thing.ThingName}, use the thing name. |
| Region | json.region |
(empty) | AWS region of the endpoint, for example eu-central-1. |
| Protocol | json.protocol |
mqtts |
MQTT over TLS with the device certificate. Only value offered. |
| Host | json.host |
(example endpoint) | Device data endpoint of your AWS account. Must be replaced by your own endpoint. |
| Port | json.port |
8883 |
MQTT over TLS port of AWS IoT. Keep 8883. |
| Device Private Key | json.privateKey |
(empty) | Content of the private key file (PEM). Required. |
| Device Cert | json.clientCert |
(empty) | Content of the device certificate file (PEM). Required. |
| Root CA Cert | json.caCert |
(empty) | Content of the Amazon root CA file (PEM). Required. |
The three files are stored in the gateway configuration: load their content, not a path. Saving the gateway restarts the driver.
The private key gives access to your AWS account as this thing: create one certificate per box, with a policy limited to the topics of the box, and revoke the certificate in AWS if a box is lost or replaced. See Security.
{
"clientId": "wbox-geneva-01",
"region": "eu-central-1",
"protocol": "mqtts",
"host": "a1b2c3d4e5f6g7-ats.iot.eu-central-1.amazonaws.com",
"port": 8883,
"privateKey": "-----BEGIN RSA PRIVATE KEY-----\n…",
"clientCert": "-----BEGIN CERTIFICATE-----\n…",
"caCert": "-----BEGIN CERTIFICATE-----\n…"
}
%aws:<topic> — everything after %aws: is the MQTT topic, used as it is to subscribe and to publish.
Examples:
%aws:building1/room1/temperature — a temperature published by the box.%aws:building1/room1/setpoint — a set point published by a cloud application and received by the box.%aws:$aws/things/wbox-01/shadow/update — publish a shadow update (the policy must allow this reserved topic).Use exact topics: MQTT wildcards (+, #) are not supported in address names.
| Label | JSON key | Default | Description |
|---|---|---|---|
| datatype | json.datatype |
number |
Decoding of the received payload, and encoding of written values. number: the payload is read as a number (a non-numeric payload gives null). string: the payload as text. json: the payload is parsed as JSON (invalid JSON gives null); a written object is sent as JSON. |
| description | description |
(empty) | Free text. |
| log | log |
never | Logging policy, see Log and Store value policies. |
Changing the datatype re-decodes the last received payload immediately.
| Property | Value |
|---|---|
| Readable | No — values are pushed by AWS IoT; a read returns the last received value |
| Writable | Yes — a write publishes the value on the topic |
| Created automatically | Yes — writing to an unknown %aws: address from a route or the API creates it (datatype from the value type) |
| Routable | Yes |
| Loggable | Yes |
device not ready.Received and published values share the same address: the address shows the last value, whichever side sent it.
| Address | Datatype | Purpose |
|---|---|---|
%aws:site1/room1/temp |
number |
Routed from the room temperature, published at each change |
%aws:site1/room1/status |
json |
Routed from a route function that builds {"temp": …, "co2": …, "occupied": …} |
%aws:site1/room1/setpoint |
number |
Published by the cloud; route it to the BACnet or KNX set point |
| Symptom | Cause | What to do |
|---|---|---|
Log incomplete TLS credentials: … |
One of the three PEM files is empty. | Load Device Private Key, Device Cert and Root CA Cert. |
Gateway restarts in a loop; log missing license |
No licence for the driver. | Add the licence in Gateways › License manager. |
Log client error (…:8883): … at connection |
Certificate not activated or not attached to a policy, wrong private key, or port 8883 blocked. | Check the certificate status and its policy in AWS, and the firewall. |
| Connected, but nothing arrives in AWS | Host is not the endpoint of your account, or the policy does not allow the topic. | Replace Host with your device data endpoint; check the policy. |
Log subscribe to topic … failed … (retry in 30s) |
The policy does not allow iot:Subscribe / iot:Receive on the topic. |
Extend the policy. |
| Connection drops every few seconds | Another client uses the same Client ID. | Give each box its own client ID. |
Write fails with device not ready |
The box is not connected to AWS IoT. | Check the connection (log connected to …). |
To read the driver log: open the gateway log (see Gateways). The log shows connecting: host=… port=… protocol=… region=… clientId=… at start.
mqtts); WebSocket with AWS Signature V4 is not offered.