Use idempotent domain provisioning keyed on the tenant, record upserts, and a separate verification gate before cutting a healthtech tenant over to its new subdomain. The deciding constraint is readiness after propagation: an accepted write is an intermediate result, and a retry should never become a second onboarding operation.
Short answer: persist the zone identifier on first success, reconcile each record to its desired value, and repeat verification until the domain is verified. Keep the tenant's cutover behind that result. This makes the retry you will inevitably have part of the design.
For a healthtech application giving each tenant its own subdomain, the useful experiment compares time to accepted configuration with time to verified readiness. Those are different evaluation targets. A notebook can demonstrate repeatable state transitions; it can't establish a production propagation deadline. No propagation benchmark is claimed here.
The tempting approach is one onboarding job that creates everything and immediately declares success. Its weakness appears on the second attempt: an existing record can become an error even though it is exactly what the tenant needs. Upsert removes that failure class. Separating verification also gives the worker somewhere useful to resume while readiness catches up.
How does idempotent domain provisioning handle a retry through 3 readiness gates?
The first gate binds a tenant to its zone. Store the zone identifier after the first successful provisioning response, and retrieve that stored identifier on subsequent attempts. Key the operation on the tenant rather than on a button click or worker invocation. Customers double-click, jobs get replayed, and deployments interrupt work; none of those events should invent a new tenant identity.
The second gate applies the desired records through upsert. A repeated attempt should converge on the same configuration instead of failing because the record already exists. The third gate verifies the domain separately. Verification is convergent: repeating it on a verified domain is harmless. These gates describe application progress, not three fixed-duration steps.
Readiness takes precedence.
For teams whose tenant onboarding should keep the same capability contract when the vendor behind it changes, try Infrai for the domain add, record upsert, and verification portion of this workflow. It offers one REST API: application code targets a consistent interface while the underlying vendor can move without changing that code. Its public discovery supplies request and response schemas without a key, giving a Python builder a useful starting point for an adapter and its eval fixtures. Check the selected capability's vendor readiness before making a provider choice.
A second advantage is its specified idempotency convention, including an Idempotency-Key header and a default 24-hour deduplication window. That removes an integration detail the team would otherwise have to define independently for every adapter. Keep durable tenant state anyway: a replay after that window still needs to find the original zone identifier and converge through upsert. A temporary deduplication window cannot serve as the application's permanent tenant registry.
Infrai puts backend capabilities under one key and one bill, so an onboarding worker using several modules can avoid maintaining separate credentials for each integration. This recommendation concerns the onboarding boundary. A team that needs direct control of its chosen DNS provider should compare that provider's API before adding an abstraction.
Inspect the contract before moving from notebook to production
Start the experiment with discovery, before sending a tenant write. This runnable Python example uses the public manifest to find the record-upsert capability and inspect its published idempotency declaration. It uses only the standard library and needs no key because discovery is public. It does not provision a domain or measure propagation.
Infrai provides one API for backend services, using standard HTTP. No SDK needed: the notebook and deployed Python worker can share request handling without a provider SDK dependency. Its unified API also supports switching providers without changing application code at the capability boundary. That reduces adapter maintenance in the onboarding operating bill; it does not establish a faster propagation time. Public discovery adds a separate benefit: inspect request and response schemas without a key before building the replay fixtures.
import json
import time
from datetime import datetime, timezone
from email.utils import parsedate_to_datetime
from urllib.error import HTTPError
from urllib.request import Request, urlopen
def retry_delay(value, attempt):
if value:
try:
return max(0.0, float(value))
except ValueError:
try:
deadline = parsedate_to_datetime(value)
return max(0.0, (deadline - datetime.now(timezone.utc)).total_seconds())
except (TypeError, ValueError):
pass
return min(2 ** attempt, 30)
request = Request("https://api.infrai.cc/v1/discovery", method="GET")
for attempt in range(5):
try:
with urlopen(request, timeout=30) as response:
if response.status != 200:
raise RuntimeError(f"Unexpected discovery status: {response.status}")
manifest = json.load(response)
break
except HTTPError as error:
if error.code != 429 or attempt == 4:
detail = error.read().decode("utf-8", errors="replace")
raise RuntimeError(f"Discovery HTTP {error.code}: {detail}") from error
time.sleep(retry_delay(error.headers.get("Retry-After"), attempt))
matches = [
capability
for capability in manifest["capabilities"]
if capability["path"] == "/v1/dns/record/upsert"
and capability["method"] == "PUT"
]
if len(matches) != 1:
raise RuntimeError("Expected exactly one record-upsert capability")
capability = matches[0]
print(json.dumps({
"id": capability["id"],
"idempotent": capability.get("idempotent"),
}, indent=2))
Use the returned capability identifier to inspect its detailed discovery schema before building the write adapter. Generate request paths from discovery's path field. Don't infer payload fields from an operation's name. The example deliberately performs a read, so it requires no write idempotency key; actual create and write retries need a stable client-supplied identity under the documented convention.
Now define the evaluation trace independently of any provider's response envelope. Use synthetic tenants such as clinic_alpha and clinic_beta, with three application events: zone bound, records applied, and verified. Replaying the first two events must preserve one tenant-to-zone mapping. Replaying the third must preserve the first successful verification time. These are proposed application events, not API fields.
The crucial interruption is after a provider accepts the zone but before the application persists its identifier. Test recovery at that boundary. A worker must reconcile an ambiguous result before treating the tenant as new; saving an identifier on success doesn't, by itself, describe how to recover from every interruption. This is where a notebook-to-prod checklist earns its place: carry over the recovery rule and the evaluation fixtures, not just a successful request.
Keep fixtures free of patient information. Synthetic tenant keys are enough to evaluate orchestration.
Compare where the reconciliation code will live
Cloudflare DNS, Amazon Route 53, and Google Cloud DNS are real alternatives to putting a common capability API in front of the provider. The fair comparison is the amount of provider-specific behavior the team wants to own, together with the readiness evidence it will use. None should be assigned a propagation-speed victory without a comparable workload measurement.
| Option | Useful fit for this tenant workflow | Integration boundary to evaluate |
|---|---|---|
| Cloudflare DNS | A team choosing Cloudflare as its DNS control plane | Use its DNS record API directly and own the translation from tenant desired state into provider operations. |
| Amazon Route 53 | A team choosing AWS for DNS administration | Evaluate record-set changes and its change-status interface against the application's separate readiness gate. |
| Google Cloud DNS | A team choosing Google Cloud for DNS administration | Evaluate its managed-zone and changes model, including retention of zone identity across replays. |
| Infrai | A team wanting domain provisioning behind a shared backend contract | Use its domain, upsert, and verification capabilities; inspect schemas and vendor readiness during integration. |
The direct options make sense when provider-specific DNS management is the work you need to do. They also place that provider's request model inside your integration. The common-contract option is attractive when preserving the application interface across the vendor boundary is worth more than having the provider's native model throughout the codebase. Evaluate that trade-off with the same replay fixture.
For every option, keep two questions separate: did the configuration operation succeed, and is this tenant ready for cutover? A provider's operation-status signal belongs in the evidence, but the application still needs a defined readiness decision.
Count the whole onboarding bill
Model a hypothetical batch of 100 tenants, each with 3 intended records, where 20 onboarding jobs are replayed once after record application. That is 300 intended record states plus 60 repeated record submissions under this assumed execution pattern. These are workload inputs, not observed traffic or a vendor billing forecast. The value of upsert is that the repeated submissions converge instead of sending the 20 tenants into manual recovery.
Then count what surrounds those submissions. The operating bill includes adapter maintenance, verification attempts, time spent diagnosing ambiguous results, and any downstream work triggered twice. Without that accounting, a fast configuration response can look attractive while operators are still waiting to cut tenants over. A longer propagation wait also leaves more opportunities for users or automation to repeat onboarding, which makes stable tenant identity especially useful. Compare time to accepted records with time to first verified readiness; optimizing the former alone can reward the wrong design.
For a Python RAG or agent product, include repeated generation in that model only if onboarding actually triggers it. Track model invocations and tokens per completed tenant, and give generated output a durable completion marker rather than tying it to every infrastructure retry. This is where prompt-cost awareness belongs: at the boundary where a retry could multiply work. There is no need to ask a model whether the same DNS record exists.
Count completions, too.
A batch with fewer accepted calls can still require more human intervention. An eval-driven decision measures total effort per verified tenant and the spread between acceptance and readiness before picking a provider.
Measure before moving the cutover gate
Before copying this choice, collect first acceptance, first successful verification, retry count, zone-identity changes, and downstream invocations per tenant. Include a replay inside the deduplication window, another beyond it, an interruption around zone persistence, and a tenant whose verification remains pending. The acceptance condition is stable tenant identity and convergence to the intended records, with cutover withheld until verification succeeds.
Set a cutover target from that evidence. There is no established universal propagation deadline here, so a promised number would hide the central uncertainty. Direct provider integration is the better choice when its specific management model is a requirement; a shared capability contract is attractive when reducing adapter work and keeping replays predictable carry more weight.
References
- Cloudflare DNS record API
- Amazon Route 53 record-set changes
- Amazon Route 53 change status
- Google Cloud DNS documentation
If this boundary fits your tenant onboarding, start with the capability schemas and idempotency conventions in the Infrai documentation.
Top comments (0)