Custom Domains and Certificates
Your name, your cert, at the edge
Pointing a custom domain at cloud services means wiring DNS records (CNAME/alias) and provisioning TLS certificates verified via DNS or HTTP. ACM/Key Vault/Certificate Manager centralize issuance, renewal and rotation.
What you will learn
- Wire a custom domain to a cloud endpoint
- Issue and renew certificates with ACME/managed CA
- Satisfy DNS/HTTP validation flows
Custom domains: add a CNAME/alias record to the LB/CDN/Function URL, then prove ownership via a TXT/DNS or HTTP/ACME challenge and get a managed TLS certificate auto-renewed at the edge.
What is this?
Cert issuance: AWS Certificate Manager (ACM) validates DNS/email and auto-renews; Azure Key Vault certificates + App Service binding (auto); GCP Certificate Manager with ACME/DNS challenge. Domain wiring: alias/CNAME/A records pointing to the endpoint DNS name; CDN (CloudFront/App Gateway/Cloud CDN) fronts the domain and terminates TLS with the cert. Validation flow: DNS challenge (TXT/_acme-challenge) or HTTP-01 file. Renewal is automatic for managed CAs when DNS/HTTP validation remains.
Why do you need it?
- A custom domain is what users remember and what you control on a migration.
- Managed CAs auto-renew → the 'certificate expired' page becomes rare.
- Terminating TLS at the edge centralizes certs and offloads handshakes.
- DNS validation survives behind NAT and doesn't need a public webserver.
Mental model
Hanging your own business sign with a pre-approved building permit
Domain + certificate
The permit (certificate authority) verifies you really own the address (domain) via paperwork left in the mail slot (DNS challenge); once approved, the sign (TLS) stays up and renews automatically like the building auto-filing the permit.
How it works
- Create a hosted zone; point the domain's NS to it (or keep the registrar's DNS and add records there).
- Add the record: alias/CNAME to your LB/CDN/Func URL (works with any HTTPS-capable target).
- Request a cert for the domain in the managed CA; choose DNS validation.
- Add the CNAME/_acme-challenge record; the CA checks it and issues.
- Attach the cert to the edge (ALB/Ingress/CDN); managed renewal keeps it fresh.
Domain + TLS wiring.
Examples
DNS validation flow on AWS
# 1) request certaws acm request-certificate --domain-name app.example.com \ --validation-method DNS --region us-east-1# 2) get the CNAME to publishaws acm describe-certificate --certificate-arn <arn> \ --query 'Certificate.DomainValidationOptions[0].ResourceRecord'# 3) add the record to the zone, wait for 'ISSUED', then attach to the LB listenerRequest → publish the validation CNAME → ACM 'ISSUED' → attach to the edge; renewal is automatic.
In production
- A multi-tenant SaaS uses ACM wildcard *.app.example.com with DNS validation per env (prod/dev).
- Azure App Service custom domains bound with a Key Vault cert that rotates automatically.
- GCP Certificate Manager ACME issues for a Cloud CDN origin and auto-renews via DNS.
Best practices
- Prefer DNS validation — automation-friendly, works behind NAT, no port 80 needed.
- Use wildcards sparingly (wildcard + specific names); scope the smallest set that serves the service.
- Keep the validation records until renewal succeeds, or breakage is silent.
- Test renewal at least once before trusting 'this is automatic'.
Common mistakes
- Deleting the _acme-challenge record after issuance → renewal silently fails, cert expires.
- Requesting the cert in the wrong region then wondering why the LB doesn't see it.
- Pointing the domain at an endpoint whose cert covers a different name (patient SNI error).
- Declaring 'we have TLS' while browsers show a mixed-content/invalid-chain warning.
Common issues
Certificate status stuck 'PENDING_VALIDATION'Validation CNAME missing/mistyped or not propagated
Add the exact record from describe-certificate; wait TTL+; then request re-validation.
Custom domain fails SNICert lacks the FQDN or the edge isn't serving that cert
Ensure the cert covers the exact domain (and www) and is bound to the listener serving it.
Debugging tips
- Cert shows 'pending' — verify the DNS record exists and propagation from a different resolver.
- Browser cert error: compare the cert's SAN list vs the requested hostname.
- Mixed content: the page loads HTTPS but assets via HTTP — inspect network tab origins.
- Expired cert despite renewal: check the validation record is still present and the CA check reaches it.
Interview checkpoint
Hands-on lab
- Exercise the DNS validation flow
- Bind a cert to an HTTPS listener
- Plan an automated renewal guardrail
Request, Validate and Bind a Domain (DNS-01)
25 min · intermediate
Quick quiz
Why is DNS validation preferred for ACME/cert issuance?