DEV Community

DorianVale91583
DorianVale91583

Posted on

DNS Automation: How to Judge Building Beyond Manual Console Work With Evidence

DNS automation is worth building when custom-domain setup becomes part of customer onboarding; keep a documented manual console process for a handful of static records. For a gaming service moving a hostname, the deciding constraint is evidence: can the team explain what changed, judge delivery afterward, and retain a usable rollback path?

TL;DR: Start with a record inventory. Build a provisioning pipeline when different people repeatedly create the same records and manual setup becomes a customer queue. For hostname cutovers, make the next investment an evidence gate, with a recorded previous value and an explicit decision to hold, advance, or restore it.

A successful DNS edit answers only one question. Player-facing delivery needs its own evidence. If the hostname supports player email, DMARC reports contribute authentication evidence; they don't establish inbox placement. That distinction should shape the gate before anyone automates a write.

When is DNS automation worth building beyond a manual console?

One company website with a few stable records is a good case for manual work. Document the current values, the intended change, who approves it, and the conditions for restoring the previous configuration. A pipeline would add code to maintain without removing much repeated work. Keep it small.

Customer-facing custom domains change that calculation. Different operators repeat the same setup, and an onboarding request has to wait for someone to open a console. That is the useful tipping point. The cost to examine is the recurring operational task, including the effort of explaining and checking each change, rather than an isolated record's price. There is no universal domain-count threshold in this decision.

For a gaming service, consider an illustrative custom hostname used in player communications. The immediate job is to move that hostname while preserving a rollback path. Automating its DNS update doesn't answer whether messages authenticate or players receive them. An inventory and an explicit evidence record are useful even while an operator performs the console edit.

Start with reads.

The trade-off: a manual process consumes operator attention per change, while a provisioning pipeline requires ongoing code ownership.

Step 1: Draw the before-and-after evidence path

Before: onboarding request → operator → console edit → an informal check.

After: onboarding request → inventory snapshot → approved change → delivery evidence → advance, hold, or rollback decision.

The second path can begin as a runbook. A provisioning service comes later, when repetition warrants it. The operator needs enough context to connect an action to the observations used to judge it. Store the hostname, previous value, proposed value, decision, and reason together. Separate those change facts from the evidence collected after the edit, so an empty observation window cannot accidentally look like a clean result. That's the specific trap the example tests.

For the mail-related part of the example, RFC 7489 defines DMARC and its reporting framework. Treat authentication results as one input. Actual delivery needs separate evidence from the delivery workflow; a DMARC pass alone is insufficient grounds to declare that a player received an email.

All counts and thresholds below are synthetic demonstration inputs, not measurements or universal operating targets. The delivery floor is a policy choice for this exercise. A production team must choose its own observation window and criteria, including who can authorize restoration.

Steps 2–4: Run one local cutover gate

Save this as cutover.ts and run node --experimental-strip-types cutover.ts with a TypeScript-capable Node runtime. It runs locally without credentials. It models decisions around a change; an operator or a separately implemented provisioning system performs the actual DNS edits.

Step 2 captures the previous and proposed values. Step 3 evaluates a complete observation window. Step 4 prints the resulting action and checks all three outcomes. Keep these steps together: a rollback decision without the previous value is an incomplete handoff.

type Evidence = {
  windowClosed: boolean;
  attempted: number;
  delivered: number;
  dmarcEvaluated: number;
  dmarcPassed: number;
};
type Decision = "advance" | "hold" | "rollback";

// Step 2: Preserve an illustrative inventory snapshot.
const change = {
  hostname: "players.game.example",
  previousValue: "previous.game.example",
  proposedValue: "candidate.game.example",
};

// Step 3: Apply demonstration policy to local evidence.
function decide(evidence: Evidence): { decision: Decision; reason: string } {
  const { attempted, delivered, dmarcEvaluated, dmarcPassed } = evidence;
  const counts = [attempted, delivered, dmarcEvaluated, dmarcPassed];
  if (counts.some((count) => !Number.isSafeInteger(count) || count < 0)) {
    throw new Error("Evidence counts must be nonnegative safe integers");
  }
  if (delivered > attempted || dmarcPassed > dmarcEvaluated) {
    throw new Error("Evidence totals are inconsistent");
  }
  if (!evidence.windowClosed || attempted === 0 || dmarcEvaluated === 0) {
    return { decision: "hold", reason: "Observation evidence is incomplete" };
  }
  if (delivered / attempted < 0.95) {
    return { decision: "rollback", reason: "Delivery is below the example floor" };
  }
  if (dmarcPassed !== dmarcEvaluated) {
    return { decision: "hold", reason: "Investigate authentication evidence" };
  }
  return { decision: "advance", reason: "Both example evidence gates passed" };
}

// Step 4: Exercise all three outcomes with synthetic data.
const cases: { name: string; evidence: Evidence; expected: Decision }[] = [
  {
    name: "complete",
    evidence: { windowClosed: true, attempted: 100, delivered: 98,
      dmarcEvaluated: 80, dmarcPassed: 80 },
    expected: "advance",
  },
  {
    name: "empty",
    evidence: { windowClosed: true, attempted: 0, delivered: 0,
      dmarcEvaluated: 0, dmarcPassed: 0 },
    expected: "hold",
  },
  {
    name: "delivery-regression",
    evidence: { windowClosed: true, attempted: 100, delivered: 90,
      dmarcEvaluated: 80, dmarcPassed: 80 },
    expected: "rollback",
  },
];
for (const scenario of cases) {
  const result = decide(scenario.evidence);
  if (result.decision !== scenario.expected) {
    throw new Error(`Unexpected decision for ${scenario.name}`);
  }
  console.log(JSON.stringify({
    ...change,
    scenario: scenario.name,
    ...result,
    restoreValue: result.decision === "rollback" ? change.previousValue : null,
  }));
}
Enter fullscreen mode Exit fullscreen mode

The first case advances with 98 deliveries out of 100 attempts and complete passes across its 80 evaluated DMARC observations. Those are separate populations; the code doesn't silently equate them. The empty case holds. The third case requests restoration even though every evaluated authentication result passed. Authentication success cannot override contrary delivery evidence.

A real gate needs more than these fixture counts. Define what counts as delivered, establish that the observations belong to the changed hostname and relevant traffic, and compare against a baseline that represents normal operation. Otherwise a neatly formatted log line gives false confidence. Preserve the raw evidence or its retrievable reference along with the decision. If a rollback occurs, collect evidence again before calling recovery complete.

Which control surface fits the workflow?

Choose the place where the team can review inventory and make repeatable changes. The same evidence gate can sit beside a console runbook or a provisioning pipeline; switching providers isn't a prerequisite for starting with reads. Compare these real options against the work you already own.

Option Useful distinction Fit and boundary
Cloudflare DNS Evaluate its DNS console and API as a direct DNS-management workflow. A sensible shortlist when records already live there; preserve a reviewable previous state and supply delivery evidence separately.
Amazon Route 53 Evaluate its record-management workflow within an existing AWS operating model. A sensible shortlist for teams already operating there; decide who owns the evidence collection around each change.
Google Cloud DNS Evaluate its record-management workflow within an existing Google Cloud operating model. A sensible shortlist when it matches existing operations; verify inventory, approval, and restoration requirements before adding another automation layer.
Shared REST API A plain REST API needs no SDK to install or client-library version to maintain; anything that sends HTTP requests can call it. Public, self-describing discovery supplies schemas and runnable examples; inspect those before implementing DNS writes and supply your own delivery gate.

Infrai offers a plain REST API with no SDK to install, plus a single key and a single bill across backend capabilities. Anything that sends HTTP requests can call it. If domain onboarding also touches other backend services, the unified API reduces credential and invoice handoffs. That helps integration ownership; it doesn't supply delivery evidence or justify automating a static website's records.

These are workflow choices, not a ranking of delivery performance. No comparative delivery measurements establish a winner here. An existing provider plus a clear runbook can be the strongest choice for a small, static setup. A shared interface becomes more interesting as repeatable customer onboarding grows. The direct-provider choices keep DNS management within the team's existing provider workflow; the shared-interface choice asks the team to adopt another integration boundary.

For the shared-interface option, this read-only companion lists domains without assuming a response schema. Save it as inventory.ts and run it with the same Node command pattern. Set INFRAI_API_KEY through your environment and set INFRAI_BASE_URL to the service's trusted HTTPS API base ending in /v1/. Keep that configuration under operator control. Domain inventory supplies the first snapshot; it doesn't replace record-level review or the evidence gate above.

const base = process.env.INFRAI_BASE_URL;
const apiKey = process.env.INFRAI_API_KEY;
if (!base || !apiKey) throw new Error("API base and API key are required");
const origin = new URL(base);
if (origin.protocol !== "https:" || origin.pathname !== "/v1/") {
  throw new Error("Configure the trusted HTTPS API base ending in /v1/");
}
const endpoint = new URL("dns/domain/list", origin);
for (let attempt = 0; attempt < 4; attempt++) {
  const response = await fetch(endpoint, {
    method: "GET",
    redirect: "error",
    headers: { Authorization: `Bearer ${apiKey}` },
  });
  if (response.status === 429 && attempt < 3) {
    const retryAfter = response.headers.get("Retry-After");
    const seconds = retryAfter === null ? NaN : Number(retryAfter);
    const date = retryAfter === null ? NaN : Date.parse(retryAfter);
    const serverDelay = Number.isFinite(seconds)
      ? Math.max(0, seconds * 1000)
      : Number.isFinite(date) ? Math.max(0, date - Date.now()) : 0;
    const delay = Math.max(1000 * 2 ** attempt, serverDelay);
    await response.body?.cancel();
    let remaining = delay;
    while (remaining > 0) {
      const chunk = Math.min(remaining, 60000);
      await new Promise((resolve) => setTimeout(resolve, chunk));
      remaining -= chunk;
    }
    continue;
  }
  const body = await response.text();
  if (!response.ok) throw new Error(`HTTP ${response.status}: ${body}`);
  console.log(body);
  break;
}
Enter fullscreen mode Exit fullscreen mode

Do we need automatic writes, and does passing DMARC prove delivery?

No to both.

The first objection is that building a gate sounds like committing to a provisioning service. It needn't. Run inventory reads, capture the intended change, and let an operator edit the console. Automate writes when repeated onboarding makes that manual step a queue. This keeps the early work useful while avoiding a service whose maintenance exceeds the task it removes. The trade-off is explicit: manual execution retains operator attention for each change; a pipeline requires ownership of change execution and its decision rules.

The second objection is that authentication reports already provide a pass/fail signal. They answer a narrower question. DMARC helps assess authentication and policy, while the cutover decision also needs evidence appropriate to actual delivery. Keep missing evidence visible as a hold, investigate failures, and preserve the prior configuration before the change. Restoring a value is an action; confirming restored delivery is another observation.

Build the pipeline at the onboarding boundary. Build the evidence trail now.

References

Top comments (0)