AWS Integration

I am wondering if anyone has any other resources to share on getting a Balena device registered and communicating with AWS IOT as a Thing? Preferably to communicate with MQTT and Python. The Balena documentation on the subject is a bit confusing and lacking in details unfortunately. It would be great to have someone expand this documentation with more details. https://www.balena.io/docs/learn/develop/integrations/aws/

Hi there, I believe there were some teammates that have done some sample projects with AWS IoT, I will ask around and let you know what I find.

Hey @tofino, sorry for the delay on this reply.

I’ve created a sample example on how to connect your balena device to AWS IoT with MQTT using Python.

I am currently working on writing a step-by-step guide how to setup it on AWS, you can check the current repository here: https://github.com/balena-io-playground/balena-aws-iot-mqtt-example

1 Like

@dansku

About AWS Integration

The combination of Balena and AWS is the coolest.

The article is about AWS IoT (mqtt protocol).
Besides that, AWS IoT certificates can be used besides MQTT.

You can use most of AWS services (CloudWatch Logs, DynamoDB, S3, API Gateway, … etc) by assuming an “AssumeRole” from a certificate.
This includes the following AWS IoT access other than the mqtt protocol:

AWS IoT on MQTT: certificate
AWS IoT on MQTT (over 443): certificate
AWS IoT on MQTT Over WebSocket: AWS IoT assume Role

However, AWS IoT’s AssumeRole has the disadvantage of an expiration time of one hour.

There is a mechanism called Credential Provider in order to support various names when calling AWS Service with AWS SDK.
Provider for environment variables and regular AssumeRole Provider are provided by default.
There is no one for AWS IoT. Fortunately, Credential Provider is extensible.
AWS IoT Credential Provider (Python) is provided as a customized Credential Provider.

Some ingenuity is required for usage.
Please see the issue I wrote.

Hey @tofino, I’ve just released a blog post showing how to connect balena with AWS IoT MQTT broker with python. Check it out at https://www.balena.io/blog/use-a-raspberry-pi-to-communicate-with-amazon-aws-iot/

Hope it helps on your project!

Cheers