Infrastructure as Code

Pulumi

Manage uptime monitors and status pages from a Pulumi TypeScript or JavaScript program. Requires Pulumi 3.216 or newer and the nodejs runtime.

Setup

bash
npm install @databuddy/pulumi
pulumi config set --secret databuddy:apiKey dbdy_...

Create the key in Organization Settings → API Keys with read:monitors, write:monitors, read:status_pages, and write:status_pages. Resources are created in the key's organization.

Example

tsx
import * as pulumi from "@pulumi/pulumi";
import { StatusPage, StatusPageMonitor, UptimeMonitor } from "@databuddy/pulumi";

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

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

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

Status page slugs are unique across all Databuddy accounts, so prefix them with your own name.

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

Dashboard Edits

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

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

Replacements and Renames

A replaced monitor starts a new check history, and dashboard alerts need to be pointed at it again.

Monitor URLs are unique per organization and slugs are unique across all accounts, so renaming a resource without aliases fails with a conflict:

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

CI

yaml
- run: pulumi up --yes --stack prod
env:
  PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
  DATABUDDY_API_KEY: ${{ secrets.DATABUDDY_API_KEY }}

Set environment variables on the pulumi process, not inside your program.

Configuration

SettingStack configEnvironment variableDefault
API keydatabuddy:apiKeyDATABUDDY_API_KEYRequired
API URLdatabuddy:apiUrlDATABUDDY_API_URLhttps://api.databuddy.cc

Stack config takes precedence. The API URL must use HTTPS unless it points at localhost. Monitors and status pages that already exist in the dashboard can't be imported.

Troubleshooting

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

What's Next?

How is this guide?