AWS IoT Provisioning

Hi all.
I am working on automatically provisioning IoT devices with AWS IoT core. I found the following repository GitHub - balena-io-examples/aws-iot-provision: Lambda function to provision a device with AWS IoT but was unable to get it to work. it seems as though some things are outdated. “The runtime parameter of nodejs14.x is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs20.x) while creating or updating functions.”
However after updating to nodejs20.x, I get “Runtime [nodejs20.x] is not supported.”
Has anyone had any success with this? I would ideally like a scenario where a new device has it’s certificates automatically configured upon first time setup.
Thanks!!

Hello @jamiear thanks for your message!

We were speaking with my colleague @kb2ma to add on our to-do list a maintenance update for this repo, so we can update the nodeJS version. If you would like to collaborate, feel free to add an issue on the repo and let’s work from there.

Thanks and let’s stay connected

Hey sorry I raised an issue, but it is in fact working

1 Like

I have successfully managed to run through the aws-iot-provision installation, and using the tool I can provision a test device.
However, when I now install the cloud-relay block to test the provisioning of an actual device - it won’t work.

  • I created a fleet, added the fleet variables specific to AWS
  • created a new device in the fleet.
  • waited for the device to update and all containers are running.
  • No device is created in AWS IOT. The device shows no logs of anything failing. Cloudwatch does not see any attempts being made to access the http endpoint.
    What can be the issue?

@cheezymcsquibble i just replied your original post! which one do you preffer to follow up?

Hi! Thanks for your quick response. I successfully followed these instructions: GitHub - balena-io-examples/aws-iot-provision: Lambda function to provision a device with AWS IoT
The test worked fine (after updating nodejs to 20.x).

Now I want to use this for my actual devices, so I followed this: GitHub - balena-io-examples/cloud-relay: Relay data to an IoT cloud provider via MQTT

My fleet has the following variables:

After the containers are running though, it doesn’t seem to do any provisioning of the device to AWS. Is there any logging I can check to see what it’s doing?

Hi @cheezymcsquibble.
I have this working where my devices are automatically provisioned with AWS on startup if they are not already.
Can you walk me through your flow and add more relevant information? Have you created the HTPP gateway for your lambda function?

Hi,

It turns out that one of the ‘install now’ block install buttons on a tutorial page doesn’t install the cloud-relay service, only the metrics gathering and MQTT Broker. I solved it by creating my own docker compose file.