Serverless monitoring engine for StatusNest. Two AWS Lambda functions that together handle service health checking, result caching, and database persistence.
EventBridge (every 60s)
│
▼
monitor Lambda ← Reads active services from RDS
│ Pings each URL (HTTP)
│ Sends result to SQS
▼
SQS Queue
│
▼
processor Lambda ← Reads SQS messages
Writes status + response_time + checked_at to Redis (TTL 90s)
Inserts row into service_status table (RDS)
- Triggered by EventBridge rule every 60 seconds
- Fetches all
is_active = trueservices from RDS - Pings each URL with a 10s timeout
- Sends
{service_id, user_id, url, status, latency_ms}to SQS
- Triggered by SQS queue
- Writes to Redis:
status:{service_id}→{status, response_time, checked_at}(TTL 90s) - Inserts historical row into
service_statustable in RDS
| Layer | Technology |
|---|---|
| Runtime | Python 3.11 |
| HTTP | urllib.request (stdlib, no extra deps) |
| Database | pg8000 (pure-Python PostgreSQL driver) |
| Cache | redis-py |
| Queue | AWS SQS |
| Scheduler | AWS EventBridge |
| Packaging | Docker (Linux-compatible deps) + zip |
DATABASE_URL ---
REDIS_URL ---
SQS_QUEUE_URL ---
Dependencies are built inside a Docker container to ensure Linux-compatible binaries, then zipped and uploaded to Lambda:
# Build processor package
docker run --rm -v "$PWD":/out python:3.11-slim bash -c \
"pip install redis pg8000 -t /out/package-processor"
cd package-processor
zip -r ../processor.zip .
cd ../processor && zip -g ../processor.zip lambda_function.py
aws lambda update-function-code \
--function-name statusnest-dev-processor \
--zip-file fileb://processor.zipstatusnest-worker/
├── monitor/
│ └── lambda_function.py # Health check + SQS sender
├── processor/
│ └── lambda_function.py # SQS consumer + Redis/RDS writer
├── terraform/ # Lambda + EventBridge + SQS Terraform (reference)
└── requirements.txt
| Repo | Description |
|---|---|
| statusnest-api | FastAPI microservices (auth, monitor, status) |
| statusnest-frontend | React SPA |
| statusnest-infra | Terraform IaC for all AWS infrastructure |