Request icon
Script icon
If icon
SlackIncomingWebhook icon
Log icon
Schedule icon

Neon Serverless Branch Lifecycle and Compute Sentinel

Audit stale Neon PostgreSQL branches, enforce branch lifecycles, and alert engineering teams via Slack to prevent compute drift with Kestra.

Categories
Cloud

Automated supervision, lifecycle enforcement, and cost optimization for ephemeral Neon serverless PostgreSQL feature branches.

How it works

  1. A daily schedule initiates the inspection workflow at 08:00 UTC.
  2. An HTTP request task queries the Neon REST API to enumerate all active project branches.
  3. An inline Python script evaluates branch age against configured retention thresholds (excluding primary production branches).
  4. A conditional flow gate determines whether orphaned or stale branches exceed the 48-hour TTL.
  5. A Slack alert is dispatched to the FinOps/Platform team with a summary of candidates eligible for pruning.
  6. Audit telemetry is recorded in the execution log for compliance and cost attribution.

What you get

  • Automated discovery of orphaned preview databases created by CI/CD pipelines.
  • Proactive prevention of unexpected compute and storage cost sprawl.
  • Centralized visibility into serverless database branch lifecycles across teams.

Who it's for

  • Platform Engineers and DevOps teams managing ephemeral preview environments.
  • FinOps practitioners tracking cloud database infrastructure spend.
  • Data Engineers leveraging branching workflows for schema testing.

Why orchestrate this with Kestra

  • Declarative, schedule-driven automation without maintaining dedicated server daemons.
  • Secure secret management for Neon API credentials and Slack webhooks.
  • Detailed execution logs and visual topology tracking every audit cycle.

Prerequisites

  • A Neon serverless account and target project identifier.
  • A Slack Incoming Webhook for dispatching notifications.

Secrets

  • NEON_PROJECT_ID: Alphanumeric project identifier from the Neon console.
  • NEON_API_KEY: Neon personal API token with project inspection permissions.
  • SLACK_WEBHOOK_URL: Target webhook endpoint for engineering alerts.

Quick start

  1. Configure NEON_PROJECT_ID, NEON_API_KEY, and SLACK_WEBHOOK_URL in your namespace secrets.
  2. Import this blueprint into your Kestra instance and trigger an execution.
  3. Review the execution output in the topology view and enable the daily schedule.

How to extend

  • Add an automated branch deletion task to directly prune stale databases after human approval.
  • Export branch cost metrics to a central BigQuery or Snowflake warehouse.
  • Trigger notifications through Microsoft Teams or PagerDuty.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.