Infracost estimates cloud costs before infrastructure changes reach production. When your self-hosted Infracost API server goes down, cost estimation pipelines break silently — engineers merge pull requests with no cost feedback, finance dashboards go stale, and budget alerts fire days later instead of at the PR stage. Because Infracost sits in CI/CD rather than in user-facing paths, its availability is easy to overlook until it fails.
This tutorial covers production-grade uptime monitoring for Infracost using Vigilmon. We will walk through:
- Monitoring the Infracost Cloud API server health endpoint
- Monitoring the Infracost dashboard
- SSL certificate monitoring for cost estimation endpoints
- Webhook alerts for DOWN/UP events
Prerequisites
- Infracost self-hosted API server running (Docker, Kubernetes, or bare metal)
- A free account at vigilmon.online
Part 1: Enable and verify the Infracost API health endpoint
The Infracost Cloud API server exposes a /health endpoint you can poll from an external monitor. This endpoint returns HTTP 200 when the server is accepting requests and connected to its backing database.
Start the Infracost API server
Docker:
docker run -d \
--name infracost-api \
-p 4000:4000 \
-e INFRACOST_API_KEY=your-saml-key \
-e POSTGRES_URI=postgres://user:pass@db:5432/infracost \
infracost/infracost-cloud:latest \
server
Docker Compose:
# docker-compose.yml
version: "3.8"
services:
infracost-api:
image: infracost/infracost-cloud:latest
command: server
ports:
- "4000:4000"
environment:
INFRACOST_API_KEY: ${INFRACOST_API_KEY}
POSTGRES_URI: postgres://infracost:${DB_PASSWORD}@db:5432/infracost
PORT: 4000
depends_on:
- db
restart: unless-stopped
db:
image: postgres:16-alpine
environment:
POSTGRES_USER: infracost
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: infracost
volumes:
- pg_data:/var/lib/postgresql/data
volumes:
pg_data:
Verify the health endpoint
curl -s http://localhost:4000/health
Expected response when healthy:
{"status": "ok"}
The endpoint returns HTTP 503 or times out when the server cannot reach its database or is still initializing. This makes it a reliable signal for external monitoring — a 200 response confirms both the server process and its database connection are working.
Part 2: Expose the health endpoint for external monitoring
The Infracost API server typically runs behind a reverse proxy (nginx, Caddy, Traefik) with TLS. Expose /health on your public domain so Vigilmon can poll it without access to your internal network.
nginx configuration
# /etc/nginx/sites-available/infracost
server {
listen 443 ssl;
server_name infracost.example.com;
ssl_certificate /etc/letsencrypt/live/infracost.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/infracost.example.com/privkey.pem;
# Allow /health without authentication
location /health {
proxy_pass http://127.0.0.1:4000/health;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
access_log off;
}
# Require authentication for all other paths
location / {
auth_basic "Infracost";
auth_basic_user_file /etc/nginx/.htpasswd;
proxy_pass http://127.0.0.1:4000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
Caddy configuration
# Caddyfile
infracost.example.com {
handle /health {
reverse_proxy localhost:4000
}
handle {
basicauth {
admin $2a$14$...
}
reverse_proxy localhost:4000
}
}
Verify the endpoint is publicly reachable:
curl https://infracost.example.com/health
# {"status": "ok"}
Part 3: Set up HTTP monitoring in Vigilmon
Monitor the Infracost API server
- Log in to vigilmon.online and click Add Monitor.
- Choose HTTP(S) monitor.
- Enter:
https://infracost.example.com/health - Set interval to 1 minute.
- Add a keyword check: must contain
"status":"ok"orok. - Add your alert channel.
- Click Save.
The keyword check matters because some reverse proxies return HTTP 200 with a custom error page when the backend is down. Checking for ok in the body confirms the Infracost process itself responded correctly.
Monitor CI/CD pipeline endpoints
If Infracost is also used in CI (GitHub Actions, GitLab CI, CircleCI), add a monitor for the CI webhook endpoint if you self-host a cost estimate comment bot:
| Endpoint | Monitor URL | Keyword |
|----------|-------------|---------|
| API health | https://infracost.example.com/health | "status":"ok" |
| Cost estimate API | https://infracost.example.com/api/v1/estimates/health | ok |
Part 4: Monitor the Infracost dashboard
The Infracost Cloud dashboard is a separate web process from the API server. Add a monitor for it directly:
- In Vigilmon, click Add Monitor.
- Choose HTTP(S) monitor.
- Enter:
https://infracost.example.com/or your dashboard URL. - Set interval to 1 minute.
- Add a keyword check for a string present on the dashboard (e.g., your company name or a known heading).
- Click Save.
Use a separate monitor per service component so the Vigilmon dashboard immediately shows which layer failed — the API server, the database connection, or the frontend dashboard.
Part 5: SSL certificate monitoring
Infracost handles sensitive infrastructure cost data. An expired TLS certificate breaks CI pipelines immediately — curl and the Infracost CLI reject invalid certificates by default, halting every cost estimate job in your organization.
- In Vigilmon, click Add Monitor.
- Choose SSL monitor.
- Enter:
infracost.example.com - Set alert threshold to 14 days before expiry.
- Add your alert channel.
- Click Save.
If Infracost is also accessible on a subdomain (e.g., api.infracost.example.com), add a separate SSL monitor for that too.
Part 6: Webhook alerts for DOWN events
Add a webhook receiver to get Vigilmon DOWN/UP events into your incident response workflow:
// webhook-receiver.ts
import express from 'express';
const app = express();
app.use(express.json());
app.post('/webhook/vigilmon', (req, res) => {
const { monitor_name, status, url, response_code, checked_at } = req.body;
if (status === 'down') {
console.error('[VIGILMON] Infracost monitor DOWN', {
monitor: monitor_name,
url,
code: response_code,
at: checked_at,
});
// Post to Slack, page on-call, create an incident ticket...
postSlackAlert({
text: `⚠️ Infracost API is DOWN\n${url}\nHTTP ${response_code}`,
channel: '#infrastructure-alerts',
});
} else if (status === 'up') {
console.info('[VIGILMON] Infracost monitor recovered', { monitor: monitor_name });
postSlackAlert({
text: `✅ Infracost API recovered\n${url}`,
channel: '#infrastructure-alerts',
});
}
res.sendStatus(204);
});
app.listen(3000);
Vigilmon sends the following payload on DOWN and UP transitions:
{
"monitor_id": "mon_abc123",
"monitor_name": "Infracost API /health",
"status": "down",
"url": "https://infracost.example.com/health",
"checked_at": "2026-06-30T09:00:00Z",
"response_code": 503,
"response_time_ms": 3021
}
Part 7: Kubernetes deployments
If you run Infracost in Kubernetes, add liveness and readiness probes and expose the health endpoint via a Service:
# infracost-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: infracost-api
namespace: finops
spec:
replicas: 2
selector:
matchLabels:
app: infracost-api
template:
metadata:
labels:
app: infracost-api
spec:
containers:
- name: infracost-api
image: infracost/infracost-cloud:latest
args: ["server"]
ports:
- containerPort: 4000
livenessProbe:
httpGet:
path: /health
port: 4000
initialDelaySeconds: 15
periodSeconds: 20
readinessProbe:
httpGet:
path: /health
port: 4000
initialDelaySeconds: 5
periodSeconds: 10
env:
- name: POSTGRES_URI
valueFrom:
secretKeyRef:
name: infracost-secrets
key: postgres-uri
---
apiVersion: v1
kind: Service
metadata:
name: infracost-api
namespace: finops
spec:
selector:
app: infracost-api
ports:
- port: 4000
targetPort: 4000
type: ClusterIP
Expose via an Ingress for Vigilmon to reach:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: infracost-api
namespace: finops
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
tls:
- hosts:
- infracost.example.com
secretName: infracost-tls
rules:
- host: infracost.example.com
http:
paths:
- path: /health
pathType: Prefix
backend:
service:
name: infracost-api
port:
number: 4000
Summary
Your Infracost deployment now has four layers of monitoring:
/healthendpoint — confirms the API server and database connection are alive, polled every 60 seconds by Vigilmon.- Dashboard monitor — a separate HTTP check on the web frontend so you know whether the API or UI layer failed independently.
- SSL monitor — alerts you 14 days before your TLS certificate expires, before CI pipelines start rejecting connections.
- Webhook/Slack alerts — DOWN and UP events reach your team channel and on-call rotation within one check interval.
Vigilmon handles check scheduling, multi-region polling, alert routing, and uptime history. When Infracost goes down, your team knows within 60 seconds — before a single engineer merges an unreviewed cost change.
Monitor your Infracost infrastructure free at vigilmon.online
#infracost #finops #devops #monitoring #cloudcost