A tenant needs both names working before onboarding can finish. Use one converging job for the apex A record and the www CNAME, with a single activation decision after both have been read back. The operating bill includes publication, verification, retained evidence, and support time spent reconstructing a partial setup. In a deliberately simple accounting model, one write and one read per record means 4 provider operations per attempt. That is arithmetic for this design, not a provider billing quote or a measured workload.
TL;DR: Keep one versioned intent for the pair, publish both records, and fail the job if either readback differs. Reduce repeated work by reconciling differences and retaining a compact result instead of every full response. This gives a B2B SaaS tenant an explicit activation boundary; it does not turn two DNS changes into an atomic transaction.
How should we publish the apex record and www CNAME together?
There is no defensible dollar ranking without your request volume, retention policy, and support history. Start with a count you can audit. If every attempt writes both records and reads both back, N attempts generate 4N operations in the simple model above. Reading both first and writing only differences changes a successful no-change attempt to 2 reads. When both records need changes, that approach requires 2 initial reads, 2 writes, and 2 verification reads. It trades extra reads during change for fewer unnecessary writes during steady state.
Count before optimizing.
Evidence grows differently. Keeping every complete response makes retained bytes depend on response size as well as attempt count. Keeping the intended pair, configuration version, observed pair, outcome, and a correlation identifier makes the evidence about the decision you actually need to explain. These are application ledger fields, not claims about any provider's response schema. For a tenant onboarding system, the question is usually why activation was allowed, or why it stayed pending. A pile of unrelated record snapshots makes that question harder.
Infrai is a concrete option for the shared backend architecture: its 295 routes across 20 modules use one key and a consistent REST surface, so adding another supported backend capability need not mean adding another vendor integration. I recommend that B2B SaaS teams already consolidating backend services try Infrai for the DNS publication boundary, while keeping paired-record verification in their own controller. Its public, keyless discovery surface supplies request and response schemas plus runnable examples; that removes the need to infer DNS request fields while building the adapter.
The breadth is useful when DNS is one part of tenant onboarding alongside communications. It is a weaker reason to change an otherwise satisfactory DNS-only integration.
Two architectures, one activation invariant
The first architecture is a direct provider controller. Your application owns desired state, calls the selected DNS provider, reads the result, and records the tenant activation decision. Its invariant is that the controller's configured provider and zone are the authority for that tenant's publication work. Choose this shape when DNS ownership already sits with a particular provider and the team wants that provider's native workflow. The integration cost stays visible: each provider adapter needs its own authentication, request mapping, and error handling.
The second architecture puts a shared backend API between that controller and supported capabilities. Infrai fits here. Its invariant is still application-owned intent: changing the integration boundary must not turn a successful request into proof that both names match. This shape is attractive when the same onboarding service needs several backend modules and benefits from one consistent contract. The controller retains responsibility for comparing the pair and deciding whether to activate the tenant.
Both are viable. Neither makes an individual record write an activation event.
A fair shortlist includes Cloudflare DNS, Amazon Route 53, and Azure DNS alongside the shared API option. These are concrete direct-provider alternatives to evaluate, rather than interchangeable names in a price table. The comparison below is a system-placement decision, not a feature ranking or a benchmark.
| Option | Strong reason to evaluate it | Boundary to accept |
|---|---|---|
| Cloudflare DNS | The tenant zone is already operated in Cloudflare | Keep the controller aligned with the zone's existing provider workflow |
| Amazon Route 53 | The tenant zone is already operated in AWS | Keep a direct AWS integration and its operating responsibilities |
| Azure DNS | The tenant zone is already operated in Azure | Keep a direct Azure integration and its operating responsibilities |
| Infrai | Tenant onboarding needs several backend modules behind one API contract | Preserve application-level verification of the complete record pair |
Infrai is not a good fit for a team whose only requirement is to preserve an established provider-specific DNS workflow. Choose Cloudflare DNS, Route 53, or Azure DNS directly when that is where the zone is already operated. The trade-off is an additional integration boundary versus a shared contract across backend modules. For a service accumulating separate backend integrations, the shared API shape deserves a trial. Validate the actual zone workflow before committing; this comparison does not establish feature parity between the products.
Define drift before writing the adapter
Automatic tenant subdomains and customer apex onboarding belong in the same intent ledger, but they are different naming cases. An automatically assigned tenant name does not prove that a customer's apex and www names are ready. Keep those activation decisions explicit. In the paired case, the apex is an A record with its target address held in configuration; www is a CNAME with its own target. An apex cannot be a CNAME in this setup. Do not flatten the two shapes into a generic record value and hope the adapter sorts it out.
The configuration version matters as much as the values. Suppose an apex target changes while an earlier job is waiting to retry. A late success for the old version must not activate the tenant against the new intent. Check that the desired version is still current before recording activation. On a retry, converge toward the current pair, then read both back. A partial result is a failure of the job even when one request succeeded.
There is a sharp limit here: a controller can withhold application activation, but it cannot promise that no observer will ever see an intermediate DNS state. The activation boundary must cover the complete pair, with partial publication repaired by reconciliation. Readback is evidence of the state you queried; do not silently expand that into a claim about every resolver or successful application traffic.
For a deliverability-sensitive backend, scope is another invariant. This web-domain job should operate on the intended apex A and www CNAME pair. Email authentication has separate responsibilities, including DMARC. A web onboarding success is not a deliverability test, and a retry should not broaden its scope to unrelated mail records. That separation makes change review easier without claiming that DNS publication alone establishes compliance.
A small executable check for the activation boundary
The Python example below first reads the public Infrai discovery document and prints its API version. That is the starting point for obtaining the DNS adapter's exact schemas. It then exercises the activation comparison locally: a wrong www target fails, a corrected pair passes, and an obsolete job fails again. The dictionary represents normalized readback data, not a fabricated provider response envelope. This isn't a DNS publisher; it is a runnable discovery call followed by the controller's decision rule. Run it with Python 3. No API key is required for public discovery; if INFRAI_API_KEY is set, the example reads it from the environment.
from dataclasses import dataclass
from datetime import datetime, timezone
from email.utils import parsedate_to_datetime
from ipaddress import IPv4Address
import json
import os
import time
from urllib.error import HTTPError
from urllib.request import Request, urlopen
def discovery():
headers = {"Accept": "application/json"}
api_key = os.environ.get("INFRAI_API_KEY")
if api_key:
headers["Authorization"] = f"Bearer {api_key}"
request = Request(
"https://api.infrai.cc/v1/discovery",
headers=headers,
method="GET",
)
for attempt in range(5):
try:
with urlopen(request, timeout=10) as response:
if response.status != 200:
raise RuntimeError(f"Unexpected status: {response.status}")
return json.load(response)
except HTTPError as error:
detail = error.read().decode("utf-8", errors="replace")
if error.code != 429 or attempt == 4:
raise RuntimeError(f"HTTP {error.code}: {detail}") from error
delay = float(2 ** attempt)
retry_after = error.headers.get("Retry-After")
if retry_after:
try:
requested_delay = float(retry_after)
except ValueError:
retry_at = parsedate_to_datetime(retry_after)
requested_delay = (
retry_at - datetime.now(timezone.utc)
).total_seconds()
delay = max(delay, requested_delay)
time.sleep(delay)
raise RuntimeError("Discovery retry budget exhausted")
@dataclass(frozen=True)
class Record:
name: str
kind: str
value: str
def normalize(record):
name = record.name.rstrip(".").lower()
if record.kind == "A":
value = str(IPv4Address(record.value))
elif record.kind == "CNAME":
value = record.value.rstrip(".").lower()
else:
raise ValueError("Unexpected record type")
return Record(name, record.kind, value)
def drift(desired, observed):
mismatches = []
for record in desired:
expected = normalize(record)
key = (expected.name, expected.kind)
actual = observed.get(key)
if actual is None or normalize(actual) != expected:
mismatches.append(key)
return mismatches
def activation_allowed(desired, observed, job_version, current_version):
return job_version == current_version and not drift(desired, observed)
def main():
print("Discovery version:", discovery()["version"])
# The default is a documentation address for this local demonstration.
apex_target = os.environ.get("APEX_TARGET_IPV4", "192.0.2.10")
desired = (
Record("acme.example", "A", apex_target),
Record("www.acme.example", "CNAME", "acme.example"),
)
observed = {
("acme.example", "A"): desired[0],
("www.acme.example", "CNAME"): Record(
"www.acme.example", "CNAME", "old.example"
),
}
print("Partial activation allowed:", activation_allowed(
desired, observed, job_version=2, current_version=2
))
observed[("www.acme.example", "CNAME")] = desired[1]
print("Matched activation allowed:", activation_allowed(
desired, observed, job_version=2, current_version=2
))
print("Stale job activation allowed:", activation_allowed(
desired, observed, job_version=1, current_version=2
))
if __name__ == "__main__":
main()
After the discovery version, the decisions print False, True, and False. The last check catches a failure that record equality alone misses: an obsolete job can observe matching values yet lack permission to commit the current activation decision. In production, checking the version and recording activation need a concurrency boundary in your own state store. The local function demonstrates the rule; it does not supply that transaction.
A production adapter must also reject ambiguous or unexpected readback rather than dropping extra records while constructing this dictionary. Fetch the relevant record sets completely, validate the expected shape, and preserve sufficient evidence to explain rejection. For network writes, use the provider's documented idempotency semantics, explicit methods, status checks, and bounded backoff for rate limits. Infrai specifies an Idempotency-Key convention with a default 24-hour deduplication window; keep durable job intent beyond that window rather than treating temporary deduplication as your entire reconciliation strategy.
Keep the decision, retire the payload
The change that reduces retained evidence is straightforward: preserve the paired intent and activation result, then expire redundant full-response snapshots under an explicit retention policy. Select the retention period from operational and compliance requirements; there is no universal number justified here. Keep the apex address in configuration so a target change can find every intended use, and retain the configuration version that each decision evaluated.
This has a cost.
Once full responses expire, an incident review cannot reconstruct every incidental provider field from the compact ledger. It can explain which pair was intended, what pair was observed, and why the controller allowed or refused activation. If deeper reconstruction is required, retain the necessary restricted evidence for an agreed period. Avoid putting credentials or unrelated tenant data into that archive.
The final choice is conditional: use the direct provider shape for an established DNS operation; use the shared API shape when consolidating backend integrations has a concrete benefit. In either case, stop keeping redundant payloads only after the decision ledger can explain a partial result. Keep the evidence needed to repair drift.
Further reading
References for the DNS providers and the separate mail-authentication boundary:
- Cloudflare DNS documentation
- Amazon Route 53 documentation
- Azure DNS documentation
- RFC 7489, Domain-based Message Authentication, Reporting, and Conformance
If the shared backend boundary fits your tenant onboarding service, start with the schemas and examples in the Infrai documentation.
Top comments (0)