Connect Pico LTE to AWS IoT Core

Connect the Pico LTE to AWS IoT Core over the cellular connection: an HTTPS POST to the device shadow, and MQTT publish and subscribe with the thing’s certificates.

These examples connect the Pico LTE to AWS IoT Core over the cellular connection: an HTTPS POST to the device shadow, and MQTT publish and subscribe. The board authenticates with the certificates of an AWS IoT thing.

Before you begin

Required

Hardware

  • Sixfab Pico LTE or Pico LTE 2Registered and active in Sixfab Connect, connected to the computer with the micro USB cable.

Software

Set up AWS IoT Core

  1. Open AWS IoT Core.

    Sign in to the AWS Management Console, type IoT Core in the search bar and select the service.

  2. Create policy.

    Under Manage in the side bar, open Security → Policies and click Create policy.

    Enter a name, set the policy effect to Allow and the policy action and resource to * (all), then click Create.

  3. Create thing.

    Open All devices → Things, click Create things, select Create single thing and click Next.

    Enter the thing’s name, set the device shadow to Unnamed shadow (classic) and click Next.

  4. Create its certificate.

    Select Auto-generate a new certificate (recommended) and click Next.

    Select the policy you created and click Create thing.

  5. Save certificates with these names.

    • Device certificate: client.pem
    • Private key file: user_key.pem
    • Root certificate: cacert.pem

    Put the three files in a folder named cert and upload the folder to the root of the board.

On the first run, the SDK moves the certificates into the module’s secure storage and deletes them from the board’s file system.

Find endpoint and topics

Open All devices → Things, select your thing, then the Device Shadows tab and Classic Shadow.

Under MQTT Topics are the host address (the endpoint) and the topics: the publish topic ends in /update.

Run examples

The scripts are in the examples/aws-iot folder of the SDK repository. AWS needs no username or password: the certificates authenticate the board. The message, PAYLOAD_JSON in the script, must be JSON: AWS IoT Core accepts JSON messages.

Troubleshooting

  • INFO: {'interval': 0, 'status': 1} with HTTPS and no message in the device shadow: the endpoint in config.json is wrong. Copy it again from MQTT Topics.
  • Status 0 but the device shadow does not change: the message was sent. Check that the topic in config.json is the publish topic ending in /update, that the policy allows all actions (*), and that PAYLOAD_JSON follows the AWS IoT Core message format.
  • MQTT: None 8883 None and no connection to the broker: config.json has no host or topic. Copy the example above and fill in its fields without breaking the JSON.
  • Certificates couldn't find in modem!: the certificate files do not have the names above, or they are not in the cert/ folder of the board.
  • Status 1 with MQTT and no other error: the certificates do not let the board sign in to the broker. Upload the correct certificates, with the correct names, to cert/; if that fails, repeat the AWS IoT Core setup and upload the new certificates.