You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The goal of this project is to extract performance metrics (such as CPU utilisation etc.) from a Raspberry Pi and feed it into AWS IoT Core.
IoT Core rules will publish events to AWS middleware which will in turn transform and store the data in DynamoDB. A simple FastAPI app will be hosted on ECS
for user access to the data.
π§βπ» Tech Stack
π’ Architecture
Below is the data flow description:
Raspberry Pi publishes CPU usage data as MQTT messages to AWS IoT Core.
IoT Core applies an IoT Rule to extract relevant fields and forward the message to SNS.
SNS (Simple Notification Service) pushes the message to an SQS Queue.
Lambda Function polls the SQS Queue, processes the message, and stores it in DynamoDB.
DynamoDB keeps a historical record of CPU metrics, allowing for future queries and analysis.
A FastAPI app hosted on ECS provides a REST API interface for the client to retrieve CPU usage data from DynamoDB.
git clone https://github.com/TomAston1996/raspi-streamer.git
cd raspi-streamer
Install dependencies with UV
uv pip install -r pyproject.toml
#or
uv sync
Create a certificates directory in the app folder to hold IoT Core certificates and ensure to add the folder to your .gitignore
Place the following certificates and keys in the folder for use when authenticating with IoT Core:
Certificate Name
Description
certificate.pem.crt
Deviceβs unique identity certificate issued by AWS IoT Core or a Certificate Authority (CA)
private.pem.key
Private key associated with the device certificate obtained from IoT Core.
public.pem.key
Public key corresponding to the private key obtained from IoT Core.
rootCA.pem
Root CA certificate that is used to verify the authenticity of the device certificate. wget -O rootCA.pem https://www.amazontrust.com/repository/AmazonRootCA1.pem
Create a .env file in the root directory with the certificate file paths like below:
π€ Raspberry Pi IoT data streaming with AWS (IoT Core, SNS, SQS, Lambda). Utilise an event-driven pipeline with a FastAPI service running in ECS to query IoT data from DynamoDB.