Skip to content

Simulated Industrial IoT deployment in AWS. Connects to the machine learning model created from the crack detection.

License

Notifications You must be signed in to change notification settings

wealthystudent/basefarm-iot-aws

Repository files navigation

aws-iot-rpi-fleet-provisioning

This CDK stack generates a custom raspbian image which automates onboarding of Raspberry Pi devices to AWS IoT Core.

📋 Table of content

🔖 Features

  • Create a custom raspbian based image which:
    • Enables connection to a WiFi network.
    • Sets a unique hostname for the device based on its Ethernet MAC address. As an example a Ethernet MAC address of dc:a6:32:01:23:45 will result in a hostname of dca632012345.
    • Requests a fully functional identity on first boot with the necessary IoT permissions that the device can use for subsequent communication with AWS IoT Core.

🎒 Pre-requisites

yarn -v && node -v

🚀 Install

1/ Create a secret to store the password for the Wifi network used by your devices

You can do it from the AWS console or from the command line:

aws secretsmanager create-secret --name RPI_WIFI_PASSWORD \
    --description "RaspberryPi Wifi Password" \
    --secret-string 'redacted'

2/ Update the stack configuration

Update the Wifi network SSID/country and public SSH key used to connect to your devices in the lib/utils/constants.ts file.

3/ Deploy the stack

Deploy this stack to your AWS account/region:

yarn && yarn build
yarn cdk deploy '*'

🛠 Usage

The CDK stack creates a CodePipeline which builds the custom raspbian image and stores it in S3.

Once the stack is deployed, you can check the progress of the pipeline in the AWS console. Once the pipeline is completed, download the custom raspbian image from S3 (Check the "Artifacts upload location" in the Codebuild project to find the S3 bucket).

Artifacts upload location

Unzip the image and write it on your Raspberry Pi sd card

unzip aws-raspbian.zip
# Find the SD card external disk
diskutil list external
# Write the image (replace /dev/disk123abcd with the name of the SD card external disk)
diskutil unmountDisk /dev/disk123abcd
sudo dd bs=1m if=aws-raspbian.img of=/dev/disk123abcd conv=sync

A Raspberry Pi booting using this image will automatically requests a fully functional identity on first boot with the necessary IoT permissions that the device can use for subsequent communication with AWS IoT Core (see rpi-image-builder/firstboot.bash).

AWS IoT Core console

Assuming you're on the same Wifi network as a device using this image, you can ssh into a device using its unique hostname and the SSH key you specified in the config:

# Replace dca632012345 with your device name
ssh pi@dca632012345.local

👀 See also

Security

See CONTRIBUTING for more information.

License

This library is licensed under the Apache-2.0 License. See the LICENSE file.

About

Simulated Industrial IoT deployment in AWS. Connects to the machine learning model created from the crack detection.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •