- Go through https://edukit.workshop.aws/en/getting-started.html to setup your environment
- Go through https://edukit.workshop.aws/en/blinky-hello-world.html to add the certificates to your AWS account
- The needed AWS Lambda functions are in
aws/readSeen.js
aws/checkInfected.js
aws/readInfected.js
- The Rules are also in aws directory:
aws/CheckInfected.json
aws/ReadInfected.json
aws/ReadSeen.json
The rules can be create following the steps described here: https://docs.aws.amazon.com/iot/latest/developerguide/iot-create-rule.html
- Roles and permissions files:
aws/my-iot-policy.json
aws/iot-policy.json
Roles and permissions can be created using the steps described here: https://docs.aws.amazon.com/iot/latest/developerguide/iot-create-role.html
The AWS Lambda functions need to run with the permissions described in those files.
- DynamoDB tables:
table name: health_alarm_seen:
- partition key: own (String)
- sort key: seen (String)
global index: seen-own-index:
- partition key: seen (String)
- sort key: own (String)
table name: health_alarm_infected
- partition key: own (String)
These two tables will be used to save the messages arriving from the devices and if needed will notify the infected devices.
Step 3: Building and deploying to Core2 for AWS IoT EduKit- The steps are similar to the "Cloud Connected Blinky" tutorial
pio run --environment core2foraws --target menuconfig
pio run --environment core2foraws
pio run --environment core2foraws --target upload
pio run --environment core2foraws --target monitor
Step 4: Demo- The Health Alert app will scan for nearby Bluetooth devices and will send the list to the AWS using MQTT:
- When a message is received on the [client-id]/seen topic the list of devices seen is saved in DynamoDB:
- If the Infected button is pressed, a message is sent to the Cloud to inform all potential contacts. The message is sent using MQTT:
Once the message is sent to AWS the Infected button will be reset back to normal.
Once the message is processed by the Lambda function all contacts are set as infected:
If the 'Check' button is used the app will send a message to the cloud requesting if the device was in contact with an infected one:
The response will be sent using MQTT to the [client-id]/check_response topic.
Comments