Infrastructure as code

Pulumi

Add uptime monitors and a status page from a Pulumi TypeScript or JavaScript program.

bash
npm install @databuddy/pulumi
pulumi config set --secret databuddy:apiKey dbdy_...
index.tstsx
import * as pulumi from "@pulumi/pulumi";
import { StatusPage, StatusPageMonitor, UptimeMonitor } from "@databuddy/pulumi";

const api = new UptimeMonitor("api", {
url: "https://api.databuddy.cc/health",
granularity: "minute",
});

const status = new StatusPage("status", {
name: "Databuddy",
slug: `databuddy-${pulumi.getStack()}`,
});

new StatusPageMonitor("api-on-status", {
statusPageId: status.id,
monitorId: api.id,
displayName: "API",
});

Needs Pulumi 3.216 or newer on the nodejs runtime. Make the key in Organization settings → API keys with the Monitors and Status pages presets. Resources go into the key's organization. Status page slugs are unique across all Databuddy accounts, so start them with your own name.

Configure resources

All arguments are also available as outputs.

UptimeMonitor

ArgumentTypeDefaultDescription
urlstringRequiredhttp or https URL to check. Changing it replaces the monitor
granularitystringRequiredminute, five_minutes, ten_minutes, thirty_minutes, hour, six_hours, twelve_hours, or day
namestring-Shown in the dashboard and on status pages
timeoutnumber-Request timeout in ms, 1000 to 120000
cacheBustbooleanfalseAdd a random query parameter to every check
pausedbooleanfalseStop checking without deleting the monitor
websiteIdstring-Link to a tracked website. Changing it replaces the monitor

StatusPage

ArgumentTypeDefaultDescription
namestringRequiredUp to 120 characters
slugstringRequiredLowercase letters, numbers, and dashes, up to 100 characters
descriptionstring-Up to 500 characters
logoUrlstring-https URL
faviconUrlstring-https URL
websiteUrlstring-https URL
supportUrlstring-https URL
themestringsystemsystem, light, or dark

Also exports organizationId.

StatusPageMonitor

ArgumentTypeDefaultDescription
statusPageIdstringRequiredChanging it replaces the entry
monitorIdstringRequiredChanging it replaces the entry
displayNamestringMonitor nameUp to 120 characters
ordernumber0Lowest first
hideUrlbooleanfalseHide the monitor URL
hideUptimePercentagebooleanfalseHide the uptime percentage
hideLatencybooleanfalseHide response times

Keep dashboard edits

pulumi refresh picks up dashboard changes, and the next pulumi up reverts them. To let the dashboard own a field, ignore it:

tsx
new UptimeMonitor(
"checkout",
{ url: "https://databuddy.cc/checkout", granularity: "minute" },
{ ignoreChanges: ["paused"] }
);

Monitors and status pages that already exist in the dashboard can't be imported.

Rename without replacing

Monitor URLs are unique per organization and slugs across all accounts, so a rename without aliases fails with a conflict. A replaced monitor starts a new check history, and its dashboard alerts need pointing at it again.

tsx
new UptimeMonitor(
"api-health",
{ url: "https://api.databuddy.cc/health", granularity: "minute" },
{ aliases: [{ name: "api" }] }
);

Run it in CI

.github/workflows/deploy.ymlyaml
- run: pulumi up --yes --stack prod
env:
  PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
  DATABUDDY_API_KEY: ${{ secrets.DATABUDDY_API_KEY }}
SettingStack configEnvironment variableDefault
API keydatabuddy:apiKeyDATABUDDY_API_KEYRequired
API URLdatabuddy:apiUrlDATABUDDY_API_URLhttps://api.databuddy.cc

Stack config wins over environment variables, which go on the pulumi process, not inside your program. The API URL must use HTTPS unless it's localhost.

Fix errors

ErrorFix
Missing Databuddy API keySet databuddy:apiKey or DATABUDDY_API_KEY
API key missing required scopeAdd the four monitor and status page scopes
already exists or already takenThe URL, website, or slug is in use elsewhere. After a rename, add aliases
was redirectedSet databuddy:apiUrl to the API's final URL
Function serialization is not supported when using bunUse runtime: nodejs
fetch failed behind a proxyExport NODE_USE_ENV_PROXY=1 (Node 22.21+) with HTTPS_PROXY, or NODE_EXTRA_CA_CERTS for TLS inspection

How is this guide?