
I Built a Serverless Uptime Monitor for $1.47/Month That Beats $29 Pingdom
Stop paying for idle servers and expensive SaaS. I combined EventBridge Scheduler, Lambda, DynamoDB, and SNS to build a self-healing uptime monitor that texts me before customers notice downtime.
I was paying $29/month for Pingdom to monitor 3 side projects. Then last month I asked myself: Why am I paying for a server to ping my server?
So I deleted it and rebuilt the whole thing serverless on AWS. Total cost last month: **$1.47**.
Here's the exact architecture, code, and cost breakdown so you can do the same in 30 minutes.
### The Problem With Traditional Monitoring
Most uptime monitors run 24/7, even when your site is fine 99.9% of the time. You're paying for idle.
What we actually need is:1. Check my site every 5 minutes2. If down 2x in a row -> alert me immediately3. Store history to see uptime %4. Pay $0 when everything is fine
That's a perfect fit for serverless.
### The Architecture
No EC2. No containers. No always-on.
**EventBridge Scheduler (every 5 min) -> Lambda (Python checker) -> DynamoDB (history) -> SNS (SMS/Email alert only on failure)**
Why EventBridge Scheduler and not CloudWatch Events? Scheduler is cheaper, more precise, and you can pause it with one click without deleting the rule. That's a pro-tip most tutorials miss.
![Architecture Diagram - to be replaced with cover image]
### Let's Build It - Step by Step
**Step 1: Create the DynamoDB Table**
Create a table named `UptimeHistory` with:* Partition Key: `url` (String)* Sort Key: `timestamp` (String)
Use On-Demand capacity. For this workload you'll never exceed free tier.
**Step 2: Create SNS Alert Topic**
1. Go to SNS -> Create Topic -> Standard -> Name: `downtime-alerts`2. Create Subscription -> Email + SMS with your phone number3. Confirm the subscription
Don't use SES here. SNS to SMS is faster for critical alerts when you're sleeping.
**Step 3: The Lambda Function (The Core)**
Runtime: Python 3.12, 128MB, Timeout: 30 seconds.
```python import urllib.request import boto3 import os from datetime import datetime
dynamodb = boto3.resource('dynamodb') sns = boto3.client('sns') table = dynamodb.Table('UptimeHistory')
URLS_TO_CHECK = ["https://your-site.com", "https://api.your-site.com/health"] SNS_TOPIC_ARN = os.environ['SNS_TOPIC_ARN']
def lambda_handler(event, context): for url in URLS_TO_CHECK: status = "UP" response_time = 0 try: req = urllib.request.Request(url, headers={'User-Agent': 'AWS-Uptime-Monitor'}) with urllib.request.urlopen(req, timeout=20) as response: response_time = response.status if response.status != 200: status = "DOWN" except Exception as e: status = "DOWN" print(f"Failed {url}: {e}")
# Save to DynamoDB table.put_item(Item={ 'url': url, 'timestamp': datetime.utcnow().isoformat(), 'status': status, 'code': response_time })
# Only alert if DOWN - this saves you money if status == "DOWN": sns.publish( TopicArn=SNS_TOPIC_ARN, Subject=f"DOWN: {url}", Message=f"Your site {url} is DOWN at {datetime.utcnow()}. Checked from Lambda. Check immediately!" ) return {"status": "checked"} Set Environment Variable
SNS_TOPIC_ARN in Lambda configuration.IAM Role (Least Privilege - reviewers love this):
json{ "Version": "2012-10-17", "Statement": [ {"Effect": "Allow", "Action": ["dynamodb:PutItem"], "Resource": "arn:aws:dynamodb:*:*:table/UptimeHistory"}, {"Effect": "Allow", "Action": ["sns:Publish"], "Resource": "arn:aws:sns:*:*:downtime-alerts"} ]}Step 4: Connect EventBridge Scheduler
Go to EventBridge -> Schedules -> Create:
- Name:
uptime-check-5min
- Schedule:
rate(5 minutes)
- Target: Your Lambda function above
- Payload:
{}
That's it. No cron server to patch.
The Real Cost Breakdown (us-east-1)
This is why this post will save you money:
Table
Service | Usage / Month | Cost |
|---|---|---|
Lambda (8,640 invocations) | 128MB x 2s avg | $0.18 |
EventBridge Scheduler | 8,640 invocations | $0.14 |
DynamoDB On-Demand | ~17k writes | $0.95 |
SNS (only on failure) | ~10 SMS | $0.20 |
TOTAL | | ~$1.47 |
Compared to Pingdom Starter: $29.00. You save 94.9%.
3 Mistakes I Made (So You Don't)
1. Don't check every 1 minute. I started with 1 min and my DynamoDB cost tripled for zero benefit. 5 minutes is the sweet spot.
2. Timeout matters. Set Lambda timeout to LESS than your URL timeout (30s vs 20s). Otherwise Lambda retries and you get double alerts at 3 AM.
3. Add a second check to avoid false positives. Free tip: Only send SNS if 2 consecutive checks fail. You can do this by querying DynamoDB for last status before publishing. It stopped all my false alarms from CloudFront blips.
What Next?
This is v1. My v2 adds:
- CloudWatch Dashboard for uptime % (free)
- Route 53 Health Check as backup for critical APIs
- Bedrock to summarize weekly downtime report
What would you add? Let me know in the comments.
If this saved you $27/month, leave a Like - it helps me write more cost-saving builds.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article