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

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

Hi.

I follow the tutorial, but can not make it work, I keep getting this error:

I try with the aws toot certificated VeriSign Class 3 Public Primary G5 root CA certificate and also with the Amazon Root CA 1. But none of them seems to work

And this is the first part of how i copied of one of the certificates, they are based 64 on one line, separated only with spaces:

LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcFFJQkFBS0NBUUVB dlJBU3lITGtBNWU0UWQyNkoweWp3bW00b0owQmZaOEhzSUVYa0pQMmgzYXN0N2JF CjdCSVVzSjk4OE1GRWZFTzF1V1NqclFCMHdTNCtUUzdUbVFrZEpncytRM2E1VTBj

can you help me understand the problem?

Since there is some setup involved in this project, you should first check the simple stuff:

  • Are the correct device environment variables set? you need AWS_ENDPOINT, AWS_PRIVATE_CERT, AWS_ROOT_CERT and AWS_THING_CERT
  • Are the certificates encoded using openssl base64 ?
  • Have you attached your thing to the correct certificate on AWS?

I have the same problem.
I created the variables and enoded the base64 certificates on my windows machine using:
certutil -encode AmazonRootCA1.pem AmazonRootCA1.txt
I downloaded the certificate from here:
https://docs.aws.amazon.com/iot/latest/developerguide/server-authentication.html

hi @Msanto,
I have just tried out the project with the same Amazon Root certificate and it works for me.
I am using openssl to encode the certificates to base64.
Given you are using certutil, can you confirm that you are not including -----BEGIN CERTIFICATE----- and -----END CERTIFICATE----- from the encoded file when pasting the value for the environment variables?

Hope this helps,
Kind regards
Rahul

hey @Msanto,

just checking if you were able to get this working?

Just a note, there was a typo in the tutorial and documentation at the time you were trying this. It was fixed later, so maybe that’s why you were having issues when deploying the project.
You can find the fix in this section.

Thanks,
Cheers!