Retire a customer's storefront mapping by listing the authorized zone, selecting exactly one record by type and name, and deleting with the identity returned by that listing. The deciding constraint is zone ownership: an e-commerce platform can govern cleanup in its own zone, while a customer's zone requires an explicitly authorized change or a customer-executed removal. A storefront disconnect request doesn't establish that authority.
Short answer: List first, preserve the complete before-state, and delete only the exact listed identity within the approved zone. Refuse ambiguous matches. Verify the resulting inventory and retain enough information to recreate a mistakenly deleted entry.
The operational signal is a domain disconnect or replacement during customer onboarding: the product no longer needs one storefront mapping, but the zone may still contain records serving other purposes. Treat that event as a request to reconcile a specific binding. A familiar name is insufficient evidence that a record belongs to this operation, and a successful control-plane response alone is insufficient evidence that the intended final state exists.
Who owns the zone being changed?
Start the runbook with an ownership decision, because a perfect record selector aimed at the wrong zone is still destructive. For a customer-owned zone, establish which party will execute the change and which zone that authorization covers; if the customer is performing it, give them the exact type, name, and expected content to inspect, then verify the result. For a platform-owned zone, resolve the storefront's approved zone binding from the platform's own configuration before reading records. Don't let a cleanup request silently replace that binding with an arbitrary zone identifier.
Ownership comes first.
Use a hypothetical storefront name such as shop.merchant.example to keep the operation concrete. Its cleanup target is one binding for that storefront, not every record whose name looks related to the merchant. Record type and name identify the candidate set; the returned identity identifies the entry to delete. If two entries match when the request expected one, the safe outcome is an unresolved cleanup requiring review. Choosing the first result turns listing order into an authorization rule.
That distinction sets the platform team's roadmap boundary. A customer-operated zone needs a review and verification workflow even if the platform never receives write access. A platform-operated zone needs a guarded executor and retained evidence. Buying a DNS API can reduce integration work, but the product still owns the relationship between customer, storefront, zone, and approved change.
Contain the change before optimizing throughput
Define the cleanup SLO around a verified outcome: an authorized request ends with its exact target absent and its recovery record retained. Separate that from storefront availability, since successful cleanup and successful customer traffic are different observations. Set numerical objectives from the product's requirements; there is no measured service-level result here that justifies promising an availability percentage.
For capacity planning, let N be the number of approved single-record removals in a batch. Budget at least N pre-change listings, N deletion attempts, and N post-change listings before accounting for retries, review, or audit persistence. For a hypothetical batch of 100 storefront disconnects, that means 300 logical operations as a planning baseline, not a throughput benchmark; pagination and retries can increase the actual request count. Ambiguous requests consume reads and operator attention without earning a deletion, so a queue sized only from successful writes will understate the work during a customer migration.
Bound concurrency by provider limits and the review capacity your team can support. On HTTP 429, honor Retry-After when supplied and otherwise back off exponentially; don't turn a disconnect campaign into a tight retry loop. For writes, use documented idempotency support where available and retain the same operation identity across retries. After an uncertain deletion outcome, re-list and reconcile before issuing another write. A transport error doesn't establish whether the server applied the request.
The awkward case is concurrent change between listing and deletion. A fresh read narrows that window; it doesn't make two requests atomic. Where the chosen provider documents conditional mutation controls, evaluate them. Otherwise, serialize your own operations for the binding, keep the read-to-delete interval short, and escalate evidence that the target changed rather than treating freshness as a guarantee.
How do you delete a single DNS record without guessing its identity?
The safe sequence is to resolve the approved zone, list its records, finish collecting the candidate set, select by type and name, confirm the expected content, and persist the full selected entry before deletion. Supply the identity from that entry to the delete operation within the same zone scope. If a listing is incomplete, don't declare the candidate unique.
Stop on ambiguity.
Consider a hypothetical approved removal of the CNAME named shop.merchant.example with content storefront.platform.example. Listing returns the identity to use; the storefront name does not supply it. Count every entry matching the approved type and name before checking the content: if two candidates match that pair, one matching the expected content doesn't make the ambiguity disappear. An empty returned identity also stops the operation. The same sequencing applies to a Node.js integration or a Go worker; changing languages doesn't resolve record identity or zone authority.
The runnable Go program below performs the read-only listing step. Set INFRAI_API_ORIGIN to the documented HTTPS API origin, INFRAI_API_KEY to your credential, and DNS_LIST_QUERY to the encoded zone-scoped query defined by the public request schema. The origin is configuration so this independent comparison contains no vendor URL. The program prints the real listing without assuming response fields; inspect and adapt that response before connecting a selector to deletion. Its 20-second timeout and 3-attempt budget are illustrative client policies, not provider limits.
package main
import (
"fmt"
"io"
"net/http"
"net/url"
"os"
"strconv"
"time"
)
func run() error {
origin, err := url.Parse(os.Getenv("INFRAI_API_ORIGIN"))
if err != nil || origin.Scheme != "https" || origin.Host == "" ||
origin.User != nil || origin.RawQuery != "" || origin.Fragment != "" ||
(origin.Path != "" && origin.Path != "/") {
return fmt.Errorf("set INFRAI_API_ORIGIN to the documented HTTPS origin")
}
key := os.Getenv("INFRAI_API_KEY")
query := os.Getenv("DNS_LIST_QUERY")
if key == "" || query == "" {
return fmt.Errorf("set INFRAI_API_KEY and schema-defined DNS_LIST_QUERY")
}
origin.Path = "/v1/dns/record/list"
origin.RawQuery = query
client := &http.Client{
Timeout: 20 * time.Second,
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
}
for attempt := 0; attempt < 3; attempt++ {
req, err := http.NewRequest(http.MethodGet, origin.String(), nil)
if err != nil {
return err
}
req.Header.Set("Authorization", "Bearer "+key)
resp, err := client.Do(req)
if err != nil {
return err
}
body, readErr := io.ReadAll(resp.Body)
resp.Body.Close()
if readErr != nil {
return readErr
}
if resp.StatusCode == http.StatusTooManyRequests && attempt < 2 {
delay := time.Second * time.Duration(1<<attempt)
retry := resp.Header.Get("Retry-After")
if seconds, err := strconv.Atoi(retry); err == nil && seconds >= 0 {
delay = time.Duration(seconds) * time.Second
} else if deadline, err := http.ParseTime(retry); err == nil {
delay = time.Until(deadline)
if delay < 0 {
delay = 0
}
}
time.Sleep(delay)
continue
}
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return fmt.Errorf("listing status %d: %s", resp.StatusCode, body)
}
_, err = os.Stdout.Write(body)
return err
}
return fmt.Errorf("listing retry budget exhausted")
}
func main() {
if err := run(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
Before connecting that selection gate to a destructive request, define how the adapter represents names and types consistently, how it obtains the entire listing, and how it durably stores the full before-state. Don't invent request fields to fill gaps in a provider contract. That matters particularly where one API operates on individual entries and another operates on record sets.
Keep the evidence useful: the approved zone, returned identity, type, name, content, other restoration fields, and operation result belong together. Logging only a success flag discards the information needed to undo the operation. Logging only selected fields is also insufficient if the original record contains additional fields required for restoration. Treat failure to persist the before-state as a reason to stop before the delete, rather than hoping the next listing will reconstruct what was removed.
Preserve the snapshot.
Buy an API, build the ownership policy
The buy-versus-build decision should follow the mutation unit and the ownership boundary. Compare the provider's documented operation with what the storefront workflow intends to remove; a shared DNS label doesn't establish interchangeable deletion semantics. The table distinguishes integration choices without treating a provider as a replacement for your authorization policy.
| Option | Buy-versus-build boundary | Fit and limitation for storefront cleanup |
|---|---|---|
| Cloudflare DNS | Buy managed DNS with an individual-record API; build the storefront-to-record binding and authorization gate. | Fits a listed-entry selector when the authorized zone is managed there; customer consent and zone access still determine whether the platform may execute cleanup. |
| Amazon Route 53 | Buy hosted-zone management with resource record set change batches; build the mapping from approved cleanup to that mutation unit. | Fits teams already managing hosted zones through that model; don't assume an individual-record identifier contract, and preserve the record-set values needed for deletion and restoration. |
| Google Cloud DNS | Buy managed zones and a Changes API with additions and deletions; build the approved change and evidence workflow. | Fits teams using its record-set model; deleting a storefront binding still requires checking the intended set and retaining its before-state. |
| Infrai | One key, one wallet, one bill across 295 routes and 20 modules reduce credential and invoice coordination for DNS alongside other backend services. A plain REST API needs no SDK to install or client library version to maintain; anything that sends an HTTP request can call it. | Fits teams buying a broader backend interface as well as DNS. Public discovery exposes request and response schemas without requiring a key, allowing contract review before provisioning the cleanup worker; customer-zone authority and selection policy remain application responsibilities. |
| Self-managed DNS and executor | Build and operate the DNS service and guarded mutation workflow. | Consider when operational control justifies owning capacity planning, service maintenance, and on-call responsibility; those obligations belong in the roadmap alongside the cleanup feature. |
The operational trade-off is explicit: buying a managed interface can reduce integration ownership, while building gives the team responsibility for the service beneath that interface. Neither decision eliminates approval, evidence retention, or reconciliation. For a customer-owned zone, a customer-executed removal may be the right boundary even when the platform already pays for managed DNS elsewhere.
Don't buy authority.
Verify the removal and rehearse restoration
Re-list the same approved zone after deletion. Confirm that the selected entry is absent and inspect the relevant remaining entries against the before-state, rather than treating a successful response as the complete acceptance test. If the target remains, or the listing is incomplete, keep the request unresolved. Investigate before another mutation.
Keep control-plane verification separate from storefront verification: record inventory establishes what the management interface reports, while the customer-facing check establishes whether the intended storefront behavior is present. Pick that check from the change request. A domain replacement and a full disconnect need different acceptance criteria, and neither should be marked healthy merely because a deletion returned success.
For rollback, use the retained record content and every restoration field required by the chosen provider to recreate the mistakenly removed entry in the approved zone. Inspect current state before restoration so the rollback does not overwrite a legitimate subsequent change. Re-creation restores the intended record data; don't assume it restores the original provider-assigned identity. Update the platform binding with the returned identity where applicable, verify the new inventory, and repeat the customer-facing check.
Close the operation only when its evidence is complete: approval, before-state, selected identity, mutation result, verification, and any restoration belong to the same change history. That is the ownership boundary worth defending during a large storefront migration. The deletion request is the small part.
Top comments (0)