Here's a cost-effective AWS architecture that fits well within the free tier:
Architecture Overview
Lambda + CloudWatch Events + S3 + SES
- CloudWatch Events triggers Lambda on a schedule (every 5-60 minutes)
- Lambda function fetches the webpage, compares with stored version
- S3 bucket stores the previous page content for comparison
- SES sends email notifications when changes are detected
Implementation Steps
1. Set up SES
- Verify your email address in SES (starts in sandbox mode)
- Note the region (us-east-1, us-west-2, or eu-west-1 recommended)
2. Create S3 bucket
- Store previous page content as text files
- Use a simple naming convention like
site-snapshot-latest.txt
3. Lambda function (Python)
import boto3
import requests
import hashlib
from datetime import datetime
def lambda_handler(event, context):
url = "https://example.com" # Your target URL
s3_bucket = "your-monitor-bucket"
s3_key = "page-content.txt"
# Fetch current page
response = requests.get(url)
current_content = response.text
current_hash = hashlib.md5(current_content.encode()).hexdigest()
# Get previous content from S3
s3 = boto3.client('s3')
try:
previous_obj = s3.get_object(Bucket=s3_bucket, Key=s3_key)
previous_content = previous_obj['Body'].read().decode()
previous_hash = hashlib.md5(previous_content.encode()).hexdigest()
except:
previous_content = ""
previous_hash = ""
# Compare and notify if changed
if current_hash != previous_hash:
send_notification(url, previous_content, current_content)
# Store new content
s3.put_object(Bucket=s3_bucket, Key=s3_key, Body=current_content)
4. CloudWatch Events rule
- Create a rule with schedule expression (e.g.,
rate(15 minutes))
- Target your Lambda function
Free Tier Considerations
- Lambda: 1M requests/month (plenty for frequent monitoring)
- S3: 5GB storage, 20K GET requests (more than sufficient)
- SES: 200 emails/day when sending from EC2/Lambda
- CloudWatch Events: Free for the first 1M events
This setup should cost essentially nothing within the free tier and gives you full control over the comparison logic. You can easily modify the Lambda function to use grep-like pattern matching or store multiple versions for detailed comparison.