Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

balena-io-examples/balena-aws-device

Repository files navigation

For balena's current cloud integration tools, see the Provision with cloud IoT docs, aws-iot-provision repo, and cloud-relay repo.

Device boilerplate for balena

This is device code for the AWS and balena integration. It automates one-time device provisioning an X.509 certificate and publish policy for a balena device. The device then can connect to AWS IoT Core and publish application data.

Setup

Set balena fleet environment variables

Name Value
AWS_DATA_ENDPOINT See IoT Core console Settings > Device data endpoint, like xxxxxxxxxxxxxx-ats.iot.us-east-1.amazonaws.com
LAMBDA API Gateway HTTP endpoint, like https://xxxxxxxxxx.execute-api.us-east-1.amazonaws.com/resinLambda-development
  • Clone this repository
https://github.com/balena-io-examples/balena-aws-device
  • Push your code
balena push [fleet-name]

Once your code downloads to the device, it automatically will run your app. If the environment variables for the IoT Core certificate aren't present, it will post its RESIN_DEVICE_UUID to the Lambda endpoint for the provisioning process. If the environment variables do exist, it will run the demo app to publish data to IoT Core.