NewWe launched on Y Combinator.Check it out
Back to Blog
Workflows12 min read

How to Automate Cloudflare Operations with Kestrel Workflows: Incident Response, Edge Provisioning, CI/CD, Security, and Zero Trust

Cloudflare sits in front of everything you run — DNS, CDN, WAF, Workers, load balancing, Zero Trust — but the operations around it are still mostly manual: someone notices the origin went down, someone blocks the attacking IP, someone remembers (or doesn't) that a certificate expires next week. Here's how to automate all of it — incident response, edge provisioning, developer requests, CI/CD, security, traffic management, and Zero Trust access — as deterministic, approval-gated Kestrel workflows, with copy-paste prompts for each.

June 6, 2026
Raman Varma
By Raman Varma, Founder & CEO

Every team running production traffic through Cloudflare carries the same operational load. A health check fails at 2am and traffic keeps flowing to the dead origin. A WAF event fires and the attacking IP keeps hammering the login endpoint while someone hunts for dashboard access. A Worker deploy fails silently, a certificate creeps toward expiry, and the person who knows how to drain a load balancer pool is on vacation. None of this is a Cloudflare problem — each response is a known, repeatable sequence of steps that happens to be executed by a human with the dashboard open. The fix is codifying those sequences as workflows that run the same way every time, with a human approving anything risky.

This post shows how to automate the seven domains of Cloudflare operations with Kestrel Workflows: incident response, edge provisioning, developer requests, CI/CD, security, traffic management, and Zero Trust access. Each section includes prompts written the way you'd hand them to the Workflow Agent — paste one in, review the workflow it builds, and activate it.

How it works: plain English in, deterministic workflows out

You describe the automation in plain English and the Workflow Agent assembles it from real building blocks — Cloudflare's control plane (DNS records from Create through Delete, cache purges — full or selective, firewall and rate-limit rules, IP and ASN blocks, WAF ruleset toggles, Worker deploys, rollbacks, and logs, load balancer pools and health checks, Tunnels, and Access policies) plus the stack around it: GitHub pull requests and Actions, Slack, PagerDuty, and Jira. The AI builds the workflow once; the workflow itself runs deterministically — the exact same steps on every execution, not an agent improvising at runtime against your production edge.

Cloudflare pushes events to Kestrel through Cloudflare Notifications webhooks — no polling delay. Security events (WAF, DDoS, firewall matches), health check failures, Worker deployment failures, and SSL certificate expirations all become triggers that fire the moment Cloudflare emits them. Workflows start from the trigger that fits the job: Security Event, Health Check Failure, Worker Deployment Failure, SSL Certificate Expiring, CI events, schedules, or plain-English developer requests. And every workflow runs inside Kestrel's access control and approval model — restrict who can invoke it and drop approval gates anywhere in the graph so nothing risky happens until the right person signs off in the dashboard, in Slack, or by merging a PR.

The Workflow Agent building a production-ready workflow from a plain-English description.

How to automate incident response in Cloudflare

Cloudflare sees your incidents before your monitoring does: the health check that catches the dead origin, the WAF event that catches the attack, the Worker deploy that fails on the edge. Because these arrive as webhooks, the workflow fires the moment Cloudflare emits the event — and the split is always the same: gathering context and notifying is safe to automate fully, and the remediation gets an approval gate.

/kestrel-workflowFailover

When a Cloudflare health check reports an origin down, send shifting the load balancer pool's weights toward the healthy origin to a Slack approval gate for the on-call engineer, and apply the new weights on approval. Post the failure and the resulting traffic distribution to #incidents in Slack, and if the affected zone is production, page the on-call engineer through PagerDuty with the health check details attached.

/kestrel-workflowMitigate

When a Cloudflare security event fires for a DDoS attack or a spike of WAF matches, send challenging the offending source IP to a Slack approval gate for the security team, and on approval add it to the zone's firewall access rules with a managed challenge and the event details recorded in the rule notes. Post a summary of the event and the action taken to #security in Slack.

/kestrel-workflowDiagnose

When a Cloudflare Worker deployment fails, fetch the Worker's recent logs, post the failure and the error context to #incidents in Slack, and create a Jira ticket for the team that owns the Worker with the logs attached — so the failed deploy is triaged with evidence, not rediscovered from scratch.

How to automate edge provisioning in Cloudflare

Provisioning on Cloudflare is the platform-owned work of putting a new service on the edge properly: monitored from day one, reachable at the right hostname, cached where it should be. Done by hand it's a checklist someone half-remembers; done as workflows it's the same governed sequence every time. Pair the Tunnel workflow with a companion teardown (“when a team requests decommissioning an internal app, delete its Cloudflare Tunnel and confirm in #platform”) so retired apps don't leave orphaned connections behind.

/kestrel-workflowProvision

When a team is taking a new public service live, create a Cloudflare health check against the new origin — HTTPS on its health endpoint, checked every 60 seconds — then create a proxied DNS record pointing the production hostname at the origin, and post both to #platform in Slack. Require platform-team approval, and include the requesting team and their stated reason in the approval message so both are recorded in the run's audit trail.

/kestrel-workflowProvision

When a team is standing up a new internal app, create a Cloudflare Tunnel named after the app so it's reachable through Cloudflare without opening any inbound ports, and post the tunnel name and ID back to the requesting team's Slack channel with a link to the connector setup docs. Send the creation to a Slack approval gate for the platform team first.

/kestrel-workflowConfigure

When a team requests edge caching for a new asset path, create a Cloudflare page rule on the requested URL pattern that turns caching on for everything under it, behind a Slack approval gate for the platform team, and confirm the rule and pattern in #platform once it's active — so static assets are served from the edge instead of hammering the origin.

How to automate developer requests in Cloudflare

"Add a DNS record in Cloudflare" is the canonical developer request — small, frequent, and almost always blocked on whoever holds the Cloudflare login. The Slack demo below is exactly that flow. Handled by request-triggered workflows, these become self-service: the request is matched to a pre-built workflow, the parameters are extracted from the phrasing, and team-scoped permissions decide who can ask for what — no dashboard access or shared API tokens required.

/kestrel-workflowCreate

When a developer requests a DNS record, create the record in the requested Cloudflare zone with the type, name, and target they specify, set proxying to their preference, and reply in Slack with the created record and its ID. Allow this for the team's non-production zones; require platform-admin approval for records in a production zone.

/kestrel-workflowUpdate

When a developer asks to block an IP address, add the requested IP to the Cloudflare zone firewall access rules with a note describing why, then confirm the block in Slack. Require approval from the on-call security reviewer before the block is applied, and scope it to the zones the requester's team owns.

/kestrel-workflowDeploy

When a developer requests a Worker deploy, deploy or update the named Cloudflare Worker script, confirm it went live, and post the result to the requester in Slack. If the deploy causes errors, roll the Worker back to the previous version. Require approval before deploying to a production Worker.

Click to expand

How to automate CI/CD with Cloudflare

Cloudflare is the last mile of your deploy pipeline: the Worker that serves the new code, the cache that's still serving the old version, the rollback nobody wants to do by hand at 6pm on a Friday. Wiring these to GitHub merges and Cloudflare's own deployment-failure signal closes the loop — the merge deploys, the deploy purges, and the failure rolls back.

/kestrel-workflowDeploy

When a pull request merges to main in our edge repository, deploy the Worker script from the merged PR to the corresponding Cloudflare Worker, and confirm the deploy with the PR link in #releases in Slack. For Workers serving production traffic, send the deploy to a Slack approval gate for the release owner first.

/kestrel-workflowDeploy

When a pull request merges to main in our frontend repository, purge the deployed URL prefixes from the Cloudflare cache — just the paths that changed, not the whole zone — and post the purged prefixes to #releases in Slack so users see the new version immediately instead of a stale cached build. No approval gate; a selective purge is cheap and reversible by the next request.

/kestrel-workflowRollback

When a Cloudflare Worker deployment fails, send rolling the Worker back to its previous version to a Slack approval gate for the release owner, roll back on approval, and post the outcome — which version is now live and why — to #releases in Slack.

Cloudflare security automation

Security on Cloudflare has two failure modes: reacting too slowly to the attack that's happening now, and forgetting the maintenance that prevents the outage later. Workflows cover both — the WAF event becomes a rate limit on exactly the attacked pattern within minutes, and the certificate expiring in three weeks becomes a tracked ticket today instead of a browser warning in production.

/kestrel-workflowAlert

When Cloudflare reports an SSL certificate approaching expiration, post the zone, hostname, and expiry date to #security in Slack and create a Jira ticket for the platform team to renew it — so certificate renewals are tracked work with an owner, not a surprise.

/kestrel-workflowMitigate

When a Cloudflare security event shows a sustained WAF attack against a specific endpoint, send creating a rate limit rule on the attacked URL pattern — with a threshold and block duration matched to the endpoint's normal traffic — to a Slack approval gate for the security team, apply it on approval, and confirm the rule in #security in Slack.

/kestrel-workflowBlock

When the security team requests blocking a hostile network, block the requested ASN across the zone with the reason recorded in the rule notes, behind a Slack approval gate for the security lead, and confirm the block and the reason in #security in Slack — so blocking an entire network is one reviewed request, not a scramble for API tokens.

How to automate Cloudflare load balancing and traffic management

Traffic management is where manual Cloudflare operations hurt the most, because the stakes are highest: draining a pool for maintenance, shifting weights for a canary, wiring up monitoring for a new origin. Each is a small dashboard change with production-wide blast radius — exactly the shape of work that should be a governed workflow. Pair the drain workflow with a re-enable companion (“when the team requests ending maintenance, re-enable the pool and confirm in #platform”) so pools don't stay drained after the window closes.

/kestrel-workflowUpdate

When a team requests draining an origin for maintenance, send disabling the corresponding Cloudflare load balancer pool to a Slack approval gate for the platform team, disable it on approval so traffic fails over to the remaining pools, and confirm the drain and the maintenance window in #platform in Slack.

/kestrel-workflowUpdate

When a team requests a canary for a new origin, send updating the load balancer's pool weights — 90% to the current origin, 10% to the canary — to a Slack approval gate for the platform team, apply the split on approval, and post the new traffic distribution to #platform in Slack.

/kestrel-workflowMonitor

When a team requests monitoring for a new origin, create a Cloudflare health check against it with the path and interval from the request, and post the health check ID and configuration to #platform in Slack — no approval gate needed, since adding monitoring changes no traffic.

Cloudflare Zero Trust and access automation

Zero Trust access changes are the most sensitive operations in this post — who can reach your internal apps — and also the most routine: contractors onboard, people leave, DNS zones accumulate records nobody remembers creating. Every access change runs behind an approval gate with the person's name in the approval message, so the run's audit trail answers "who approved this and why" forever.

/kestrel-workflowGrant

When a manager requests access for a new contractor, send adding the contractor's email to the Cloudflare Access policy for the named internal app to a Slack approval gate for the security team — with the contractor's name, the app, and the stated reason in the approval message — update the policy on approval, and confirm privately to the requester in Slack.

/kestrel-workflowRevoke

When a manager requests offboarding a departing person, send removing their email from the Cloudflare Access policy of the named internal app to a Slack approval gate for the security team, with the departing person's name in the approval message. Update the policy on approval and confirm the removal in #security in Slack — so offboarding at the edge happens the day someone leaves, not at the next quarterly review.

/kestrel-workflowAudit

Every Monday at 9am, list the DNS records in each of our production Cloudflare zones and post the inventory to #security in Slack — record counts per zone and the full listing of names, types, and targets — so unexpected or forgotten records get spotted in review instead of discovered during an incident.

Making Cloudflare easier to manage

Twenty-one workflows, seven domains, one pattern: describe the operation in plain English, let the Workflow Agent assemble it from real Cloudflare blocks and the stack around them, review the graph, and put approval gates on anything that touches production traffic or access. Cloudflare keeps doing what it's best at — serving and protecting your traffic at the edge — and Kestrel turns its events into governed action: traffic shifts, IP and ASN blocks, rate limits, Worker deploys and rollbacks, cache purges, Tunnels, Access changes, pages, and tickets. The recurring 80% runs itself, and your team's time goes to the judgment calls.

This isn't Cloudflare-only, either. The same workflow engine spans 30+ integrations across infrastructure, PaaS, observability, comms, databases, CI/CD, and IaC — so the workflow that drains a load balancer pool lives next to the one that restarts a Kubernetes deployment or resyncs a failed ClickPipe. For deeper dives, see the internal developer platform guide and the companion posts on automating Kubernetes operations, automating AWS cloud operations, automating Vercel operations, automating Neon operations, automating ClickHouse operations, automating Supabase operations, and automating PlanetScale operations.

FAQ: automating Cloudflare operations

How do you automate Cloudflare operations?

Turn each recurring edge event — a failing health check, a WAF attack, a failed Worker deploy, an expiring certificate — into a deterministic, approval-gated workflow instead of a human watching the dashboard. With Kestrel, you describe the automation in plain English, the Workflow Agent assembles it from real Cloudflare blocks plus the stack around them (GitHub, Slack, PagerDuty, Jira), and it runs the exact same steps every time, pausing at approval gates before anything risky.

What is the best automation tool for Cloudflare?

It depends on scope. Terraform and the Cloudflare API are the right primitives for declarative configuration and scripting individual operations. For turning Cloudflare events into governed action across your whole stack — traffic shifts, IP and ASN blocks, rate limits, Worker deploys and rollbacks, cache purges, Tunnel and Access changes, pages, and tickets in one system — Kestrel Workflows builds deterministic workflows from plain English, triggered by security events, health check failures, Worker deployment failures, SSL expirations, schedules, CI events, and developer requests.

Is it safe to automate destructive operations in Cloudflare?

Yes — if the automation is governed. In Kestrel, anything that changes production traffic or access — DNS records in production zones, pool drains and weight shifts, IP and ASN blocks, Worker deploys and rollbacks, Tunnel creation, and Access policy changes — pauses at an approval gate until the right person signs off in Slack, with the requester, the reason, and every step recorded in the run's audit trail. Read-only workflows (DNS inventories, Worker logs, notifications, and tickets) are always safe to run ungated.

How do you make Cloudflare easier to manage?

Reduce the number of edge events a human has to react to. Automate the recurring responses — origin failovers, attack mitigations, failed Worker deploys, expiring certificates — give developers self-service DNS records, IP blocks, and Worker deploys without dashboard access, and keep humans in the loop only where judgment matters: approving production DNS changes, traffic shifts, and access policy updates, not babysitting the dashboard.

Getting started

Connect Cloudflare — an API token and a Notifications webhook, about five minutes end to end — then pick the domain that hurts most. For most teams that's incident response: the health check failure that should shift traffic and page someone, instead of flowing requests to a dead origin until a customer notices. Paste one of the prompts above into the Workflow Agent, review the workflow it builds, tighten the scoping and approvals, activate it, and add the next one. The Workflows Quickstart walks through your first workflow end to end, and the Create Workflows guide and Integrations Setup cover connecting GitHub and the rest of your stack. Prefer the terminal or an AI coding agent? Workflows can also be created and managed through the CLI, Python SDK, and MCP. Within a few weeks every zone, Worker, and load balancer that matters will have a workflow behind it — and an audit trail to prove it.

Automate your Cloudflare operations with $1,000 in credits

Incident response, edge provisioning, developer requests, CI/CD, security, traffic management, and Zero Trust access — describe each workflow in plain English and Kestrel builds it. New accounts get $1,000 in usage credits to get started.

Get Started