Skip to content
LR

VigilWatch

A serverless AWS uptime monitor that tells a failed check from a failed checker, built and tested offline for about $0 inside the free tier.

Sole engineer · 2026 · prototype

The problem

Small teams still need to know when a service becomes unreachable, but running a dedicated monitoring server adds infrastructure, maintenance and cost out of proportion to the workload. VigilWatch asks how little that can cost: managed AWS services that schedule checks, record incidents and notify someone, with no servers and a target bill of about $0 inside the free tier. The project is as much about the trade-offs behind that constraint as about the monitor itself.

How it fits together

The monitoring loop is event-driven end to end. EventBridge provides the schedule, Lambda probes the endpoints, DynamoDB persists the state, and SNS sends the alerts. Failed runs go to an SQS dead-letter queue. Separately, a browser signs in through Cognito and calls API Gateway with a JWT to register URLs and read their history, while S3 and CloudFront serve the dashboard. CloudWatch watches the system itself, and Terraform defines all of it.

  1. 01

    Schedule

    EventBridge triggers the checker every five minutes.

  2. 02

    Check

    Lambda probes all enabled endpoints in parallel and classifies each result.

  3. 03

    Record

    DynamoDB stores the latest result, history, daily rollups and incident state.

  4. 04

    Alert

    SNS emails when a failure threshold opens an incident, and again on recovery.

  5. 05

    Observe

    CloudWatch captures logs, metrics and alarms; failed runs land in a dead-letter queue.

Cloud

AWS Lambda
Three Python 3.12 functions on arm64: the scheduled checker, plus register and read endpoints for the API. Standard library only, so there is no dependency packaging.
Amazon EventBridge
Triggers the checker on a five-minute schedule.
Amazon API Gateway
An HTTP API with a JWT authorizer, CORS limited to the dashboard origin and throttling, rather than a more expensive REST API.
Amazon Cognito
Handles PKCE sign-in from the browser. Users are created by the owner with no self sign-up, as an abuse control.
Amazon SNS
Sends DOWN, REMINDER and RECOVERED emails, and carries alarm notifications.
Amazon SQS
A dead-letter queue that captures failed scheduled runs, with no retries because the next run is minutes away.
Amazon S3 + CloudFront
Hosts the static dashboard without a web server, with Origin Access Control keeping the S3 bucket private and security headers set at the edge.
CloudWatch
Collects structured logs, embedded-format metrics and alarms, including one for a checker that cannot see the internet.
IAM
One role per function, scoped to specific tables, topic, queue and log group. Tests fail on any wildcard action or resource.

Data

Amazon DynamoDB
Two provisioned tables for endpoints and history, with TTL on raw checks and daily rollups so a 30-day uptime figure is read from at most 30 items. Provisioned capacity stays inside the always-free tier; on-demand does not.

Tooling

Terraform
Defines everything across eight modules and two thin environments, each with its own mocked terraform test suite.
GitHub Actions
Runs the quality gates, deploys dev, promotes the same build to prod with approval, supports rollback, and checks for drift weekly. AWS access is through OIDC, so there are no stored keys.
pytest + moto
Drives unit, mock, integration, contract, BDD and policy test layers against simulated AWS, enforcing a 90% branch coverage gate.

Decisions

Telling a failed check from a failed checker

If the monitor loses its own internet access, every endpoint looks down and everyone gets paged for nothing. VigilWatch only probes a set of control URLs when something is DOWN and nothing answered, so a healthy fleet costs no extra requests. If no control answers, the checker is blind: every DOWN becomes INCONCLUSIVE, which is stored and shown but never opens or closes an incident, sends an alert or counts toward uptime. The stated cost is that a real outage coinciding with every control being unreachable stays hidden.

An alert state machine that resists flapping

An incident opens only after consecutive failures reach a threshold, and recovery needs several consecutive healthy checks before it closes. One DOWN email is sent per incident, with a retry if it never went out and optional reminders while it stays open.

Serverless over a monitoring server

The workload is periodic rather than continuously compute-bound. EventBridge and Lambda avoid keeping a process alive to wait for the next check and shift scaling and host maintenance to managed services.

Design the bill, not just the system

Provisioned DynamoDB stays in the always-free tier where on-demand would not. A single metric dimension keeps custom metrics fixed at seven, because a per-URL dimension would cost at least $27 a month at 100 URLs. A CI check adds up both environments and fails if the total exceeds the free-tier allowance.

Security before convenience

Each function has its own narrowly scoped role. A guard against server-side request forgery requires every resolved address to be globally routable, and runs again before each probe because DNS can change. The API refuses a request without a usable subject in its verified claims, so a misconfigured route cannot open the data.

No VPC for a workload that doesn't need one

Lambda talks to managed AWS services and to external HTTP endpoints, not to anything inside a private network, so adding a VPC would have meant subnets, route tables and NAT gateways justified by nothing. The only non-public target reachable is the Lambda runtime API on loopback, which the URL guard blocks.

Implementation

Infrastructure as Code

Terraform is split into eight modules composed by a shared root, with thin dev and prod environments and a bootstrap root for state and CI roles. Every module and environment has its own terraform test suite running against a mocked AWS provider, including checks that fail on wildcard IAM.

Layered test strategy

Over a thousand tests are split into layers enforced by markers: unit, mock, integration against a moto server, contract tests against the OpenAPI schema, BDD features, policy checks and frontend tests. A test creates an IAM user with the exact rendered policy and runs each handler under enforcement, so a missing permission fails a test. Requirement markers feed a generated traceability matrix, and CI fails if tests were skipped or fewer ran than were collected.

Delivery pipeline

GitHub Actions authenticates to AWS through OIDC. Every push to main deploys dev, production is promoted manually with approval from the same build that dev released, rollback takes a commit SHA, and a weekly job opens an issue if the live infrastructure drifts from the code. The bundle is built reproducibly and each handler is imported inside the Lambda container image before release.

Proving a cloud system without a cloud

The hardest constraint was verifying behaviour that only exists on AWS, such as IAM enforcement, queue and topic wiring, and failure paths, without deploying anything. The answer was to push as much as possible into simulated AWS and to be strict about what that proves: every claim in the docs carries an evidence tag, from a CI job, a mock test, a repository file, or an explicit marker for what cannot be proven until deployment. Cold-start numbers, Cognito behaviour, metric extraction and alarm behaviour all sit in that last group. The lesson was that an honest boundary between tested and assumed is worth more than a confident claim.

Where it landed

VigilWatch is a complete serverless monitor with scheduled checks, incident state, alerting, an authenticated dashboard, Terraform-managed infrastructure and a deliberate test and delivery pipeline. It has never run in a live AWS account, so performance, cold starts and the SLO targets are unproven. Other known limits are a single region and a single probe location, which cannot tell a site being down from the path to it being down, and provisioned DynamoDB that can throttle under bursts. Deploying it is the optional next stage, and nothing else depends on it.

Lessons

Cloud architecture is about failure modes

Knowing what an AWS service does is not enough. The important work is understanding what happens when a stage fails, and how the system makes that failure visible, including the case where the monitor itself is the thing that is broken.

Infrastructure belongs in version control

Terraform turns cloud architecture into a reviewable artefact, and tests on the infrastructure catch things like wildcard permissions before anything is deployed.

Cost is a design input

Free-tier limits, metric cardinality and provisioned versus on-demand capacity shaped the architecture as much as the functional requirements did. Observability needs the same cost-consciousness as the rest of the system, not a blank check because it's just logs.

State what is proven and what is not

Tagging every claim by how it is evidenced made the documentation more trustworthy and made the remaining gaps explicit, rather than leaving them to be discovered after launch.