← Back to Projects
project image

Raspberry Pi Tracker

20/08/2024

Overview

This project uses an AWS Lambda function to track an RSS feed and provide real-time updates on Raspberry Pi stock availability via AWS SNS. During the chip shortage, finding Raspberry Pi boards in stock was nearly impossible - this automated tracker solved that problem by monitoring stock feeds 24/7 and sending instant notifications.

Features

Technology Stack

AWS Services Used:

Development Tools:

Architecture

The system follows a simple yet effective serverless pattern:

  1. CloudWatch triggers the Lambda function on a schedule
  2. Lambda fetches and parses the RSS feed
  3. Compares current stock with previous state
  4. If new stock detected, publishes message to SNS topic
  5. SNS sends notifications to all subscribers

Installation & Setup

Prerequisites:

Step 1: Clone the repository

git clone https://github.com/WaterSpooner/RaspberryPiStock.git
cd RaspberryPiStock

Step 2: Install Python dependencies

cd lambda
pip install -r requirements.txt -t .

Step 3: Configure AWS credentials

aws configure

Step 4: Deploy infrastructure

terraform init
terraform plan
terraform apply

After deployment, Terraform will output the SNS topic ARN. Subscribe to this topic to receive notifications!

Configuration

The CloudWatch schedule can be customized in the Terraform configuration:

resource "aws_cloudwatch_event_rule" "stock_check_schedule" {
  name                = "raspberry-pi-stock-check"
  description         = "Trigger Lambda every 60 minutes"
  schedule_expression = "rate(60 minutes)"
}

Change rate(60 minutes) to your desired frequency (e.g., rate(30 minutes) for more frequent checks).

Future Enhancements

Results

This tracker successfully helped me buy Raspberry Pi 4s during the height of the chip shortage. The automated notifications arrived within minutes of stock appearing, giving a crucial advantage over manual checking.

Source Code

View on GitHub