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
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
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
StatusPage
Also exports organizationId.
StatusPageMonitor
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:
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:
new UptimeMonitor(
"api-health",
{ url: "https://api.example.com/health", granularity: "minute" },
{ aliases: [{ name: "api" }] }
);CI
- 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
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
What's Next?
How is this guide?