# AWS Integration

**URL:** <https://forums.balena.io/t/aws-integration/15537>\
**Category:** Product support\
**Created:** [June 18, 2019, 12:13am UTC](https://forums.balena.io/t/aws-integration/15537 "2019-06-18T00:13:10Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![tofino](https://avatars.discourse-cdn.com/v4/letter/t/898d66/32.png) [@tofino](https://forums.balena.io/u/tofino)\
**Post date:** [June 18, 2019, 12:13am UTC](https://forums.balena.io/t/aws-integration/15537/1 "2019-06-18T00:13:10Z")

</div>

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/](https://www.balena.io/docs/learn/develop/integrations/aws/)

---

<div class="post-metadata">

**Author:** ![sradevski](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/sradevski/32/1609_2.png) [@sradevski](https://forums.balena.io/u/sradevski)\
**Post date:** [June 18, 2019, 4:43pm UTC](https://forums.balena.io/t/aws-integration/15537/3 "2019-06-18T16:43:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dansku](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/dansku/32/1183_2.png) [@dansku](https://forums.balena.io/u/dansku)\
**Post date:** [July 9, 2019, 3:13pm UTC](https://forums.balena.io/t/aws-integration/15537/9 "2019-07-09T15:13:45Z")

</div>

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](https://github.com/balena-io-playground/balena-aws-iot-mqtt-example)

---

<div class="post-metadata">

**Author:** ![dansku](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/dansku/32/1183_2.png) [@dansku](https://forums.balena.io/u/dansku)\
**Post date:** [July 16, 2019, 5:32pm UTC](https://forums.balena.io/t/aws-integration/15537/16 "2019-07-16T17:32:24Z")

</div>

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/](https://www.balena.io/blog/use-a-raspberry-pi-to-communicate-with-amazon-aws-iot/)

Hope it helps on your project!

Cheers

---

<div class="post-metadata">

**Author:** ![Denisse](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/denisse/32/2406_2.png) [@Denisse](https://forums.balena.io/u/Denisse)\
**Post date:** [August 23, 2019, 3:00am UTC](https://forums.balena.io/t/aws-integration/15537/17 "2019-08-23T03:00:22Z")

</div>

Hi.

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

 ![image](https://global.discourse-cdn.com/balena/original/2X/b/b0fef503e5679428343cdd848f16a02433611f14.png)

I try with the aws toot certificated [VeriSign Class 3 Public Primary G5 root CA certificate](https://www.symantec.com/content/en/us/enterprise/verisign/roots/VeriSign-Class%203-Public-Primary-Certification-Authority-G5.pem) and also with the [Amazon Root CA 1](https://www.amazontrust.com/repository/AmazonRootCA1.pem). 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?

---

<div class="post-metadata">

**Author:** ![lucianbuzzo](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/lucianbuzzo/32/615_2.png) [@lucianbuzzo](https://forums.balena.io/u/lucianbuzzo)\
**Post date:** [August 23, 2019, 7:23am UTC](https://forums.balena.io/t/aws-integration/15537/18 "2019-08-23T07:23:35Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Msanto](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@Msanto](https://forums.balena.io/u/Msanto)\
**Post date:** [December 22, 2019, 1:32pm UTC](https://forums.balena.io/t/aws-integration/15537/20 "2019-12-22T13:32:26Z")

</div>

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](https://docs.aws.amazon.com/iot/latest/developerguide/server-authentication.html)

---

<div class="post-metadata">

**Author:** ![rahul-thakoor](https://avatars.discourse-cdn.com/v4/letter/r/9de053/32.png) [@rahul-thakoor](https://forums.balena.io/u/rahul-thakoor)\
**Post date:** [December 23, 2019, 11:30am UTC](https://forums.balena.io/t/aws-integration/15537/21 "2019-12-23T11:30:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rahul-thakoor](https://avatars.discourse-cdn.com/v4/letter/r/9de053/32.png) [@rahul-thakoor](https://forums.balena.io/u/rahul-thakoor)\
**Post date:** [January 23, 2020, 6:13am UTC](https://forums.balena.io/t/aws-integration/15537/30 "2020-01-23T06:13:49Z")

</div>

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](https://www.balena.io/blog/use-a-raspberry-pi-to-communicate-with-amazon-aws-iot/#addenvironmentvariables).

Thanks,  
Cheers!
