I have shipped auth three ways. We rolled our own, we ran Cognito, and we migrated a production app to Auth0 under enterprise SSO pressure. This is how I model 12-month TCO and what actually broke.
The Scenario And Assumptions I Use
You can swap numbers, the structure is what matters. The typical B2C or prosumer workload we benchmark against looks like this:
- 25k MAUs in month 1, ramping to 60k by month 12, linear growth.
- Average 2 interactive logins per MAU per month. 30 percent sessions use refresh tokens.
- 12 percent of logins require SMS MFA. Each MFA flow sends 1.3 SMS on average, including retries.
- 2 first party SPAs, 1 mobile app, 5 backend services, and 4 partner integrations using client credentials.
- 12k machine-to-machine token grants per day across CI jobs and services.
- Email OTP fallback at 3 percent of logins.
- 3 environments. 99.9 percent availability target. 24 hour RPO, 4 hour RTO.
Security posture:
- Rotating signing keys every 90 days, JWKS served over a custom domain.
- Refresh token rotation, reuse detection, and 30 day idle lifetime.
- OIDC for apps, SAML for 2 enterprise customers in H2.
Compliance expectations:
- SOC 2 now. HIPAA potential in H2 if the roadmaps succeed. If that is you, do not skip a threat model and logging plan. We have a short playbook under our service for security-aware engineering and HIPAA, but start with your own data map first. If you want a structured evaluation, we run them under our vendor stack decisions service.
Concrete links for reference while reading:
- If you need a structured evaluation with trade studies and exit criteria, we do that under our vendor stack decisions work at /services/vendor-stack-decisions.
- For HIPAA constraints and BAAs, see examples from our HIPAA systems practice at /services/hipaa-systems.
- If your front door needs to change with this decision, our deep dive on API gateways and load balancers at /insights/api-gateway-rest-vs-http-vs-alb-vs-nlb-pick-the-right-front-door covers the impact on auth headers and JWT size.
- If you want an outside look at your auth perimeter before a migration, our architecture review offering at /services/architecture-review is scoped for this class of change.
A 12-Month TCO Model You Can Run
Do not trust vendor price pages blindly. Use a model you can tweak. The code below is a small Python calculator I use in docs. Rates are example defaults only. Replace them with current pricing and your SMS and email provider rates.
# tco_auth.py
# Simple 12-month TCO calculator for Auth0, Cognito, and Custom
# Defaults are examples. Validate with current vendor pricing.
from dataclasses import dataclass
from typing import List, Dict
@dataclass
class Workload:
mau_month1: int = 25000
mau_month12: int = 60000
avg_logins_per_mau: float = 2.0
pct_mfa_sms: float = 0.12
sms_per_mfa: float = 1.3
pct_email_otp: float = 0.03
m2m_grants_per_day: int = 12000
months: int = 12
def mau_by_month(self) -> List[int]:
step = (self.mau_month12 - self.mau_month1) / (self.months - 1)
return [round(self.mau_month1 + step * i) for i in range(self.months)]
@dataclass
class Rates:
# Auth0 example rates
auth0_per_mau: float = 0.03 # USD per MAU
auth0_min_monthly: float = 0.0 # base minimum, if any
auth0_m2m_per_1k: float = 0.50 # per 1000 client credentials token grants
auth0_enterprise_addon: float = 700.0 # SAML, organizations, log streaming, per month
auth0_custom_domain: float = 25.0 # per tenant per month
# Cognito example rates
cognito_per_mau: float = 0.005 # USD per MAU
cognito_advanced_sec_per_mau: float = 0.001 # optional advanced security features
# Shared infra and comms
sms_per_msg: float = 0.0075 # US SMS via SNS or Twilio
email_per_1k: float = 0.10 # transactional email per 1000
# Custom build costs
eng_burn_per_month: float = 24000.0 # fully loaded cost per senior engineer per month
eng_initial_person_months: float = 4.5 # to MVP with SSO and MFA
eng_ongoing_fte: float = 0.35 # steady state FTE per month
custom_infra_monthly: float = 450.0 # DB, cache, 2-3 nodes, log storage, backups
pen_test_once: float = 15000.0 # annual external pen test
def comms_costs(w: Workload, r: Rates) -> Dict[str, float]:
mau = w.mau_by_month()
logins = [m * w.avg_logins_per_mau for m in mau]
sms = sum(l * w.pct_mfa_sms * w.sms_per_mfa for l in logins)
email = sum(l * w.pct_email_otp for l in logins)
return {
"sms": sms * r.sms_per_msg,
"email": (email / 1000.0) * r.email_per_1k,
}
def auth0_cost(w: Workload, r: Rates) -> Dict[str, float]:
mau = w.mau_by_month()
mau_cost = sum(max(r.auth0_min_monthly, m * r.auth0_per_mau) for m in mau)
m2m = w.m2m_grants_per_day * 30 * w.months
m2m_cost = (m2m / 1000.0) * r.auth0_m2m_per_1k
addons = (r.auth0_enterprise_addon + r.auth0_custom_domain) * w.months
comms = comms_costs(w, r)
total = mau_cost + m2m_cost + addons + comms["sms"] + comms["email"]
return {"total": total, "breakdown": {"mau": mau_cost, "m2m": m2m_cost, "addons": addons, **comms}}
def cognito_cost(w: Workload, r: Rates) -> Dict[str, float]:
mau = w.mau_by_month()
mau_cost = sum(m * (r.cognito_per_mau + r.cognito_advanced_sec_per_mau) for m in mau)
comms = comms_costs(w, r) # SMS and email billed separately
total = mau_cost + comms["sms"] + comms["email"]
return {"total": total, "breakdown": {"mau": mau_cost, **comms}}
def custom_cost(w: Workload, r: Rates) -> Dict[str, float]:
# Engineering
build = r.eng_burn_per_month * r.eng_initial_person_months
run = r.eng_burn_per_month * r.eng_ongoing_fte * w.months
infra = r.custom_infra_monthly * w.months
pentest = r.pen_test_once
comms = comms_costs(w, r)
total = build + run + infra + pentest + comms["sms"] + comms["email"]
return {"total": total, "breakdown": {"build": build, "run": run, "infra": infra, "pen_test": pentest, **comms}}
if __name__ == "__main__":
w = Workload()
r = Rates()
a = auth0_cost(w, r)
c = cognito_cost(w, r)
k = custom_cost(w, r)
def fmt(x):
return f"${x:,.0f}"
print("12-month TCO (example rates)")
print("Auth0:", fmt(a["total"]), a["breakdown"])
print("Cognito:", fmt(c["total"]), c["breakdown"])
print("Custom:", fmt(k["total"]), k["breakdown"])
On my defaults this prints ballpark numbers like Auth0 at low six figures, Cognito at mid five figures plus SMS, and custom in the mid to high six figures once you include engineering. Your reality changes quickly with MAU growth and SSO requirements. Check current vendor pages before committing.
Where The Money Actually Goes
Auth0
- MAU based. The per MAU line item dominates above 20k MAU. The enterprise SSO add on and advanced features like organizations, anomaly detection, and log streaming flip a switch on cost when you need them. Machine to machine traffic is not free, model token grants flowing through your CI and services.
- Hidden costs. Custom domains per tenant and region, Actions executing on every login, and log retention beyond 7 days if you need audit trails. CDN egress for hosted login serves every pixel and script from their domain unless you optimize Universal Login branding carefully.
Cognito
- MAU based and cheaper per MAU. You will pay separately for SMS via SNS or Twilio and for advanced adaptive security features if you turn them on. Expect to spend engineering hours on hosted UI quirks, token lifetimes, and multi app tenant modeling in a single pool.
- Hidden costs. CloudWatch logs and Kinesis if you stream everything for audit. You will likely build your own thin orchestration layer for magic link, email templates, and org membership. That is engineering time you should include.
Custom
- Engineering dominates in year one. A usable baseline with password auth, OIDC, refresh rotation, SMS MFA, email magic links, admin UI, audit logging, and SAML SP can take 3 to 6 person months for seniors who have done it before. Ongoing care and feeding is a third to a half of an engineer.
- Hidden costs. Pen test, incident drills, runbooks, on call, keys rotation, consent and data subject requests if you store profile data. If you ever need BAA or export controlled data, you also need to own your crypto modules choices and documentation.
Roadmap Constraints, Lock In, And The Traps We Hit
- Token shape lock in. We had services hard coded to claim names that were only present in Auth0. Migration back to a standards only shape took two sprints. Keep domain specific claims in your own userinfo API layer, not in vendor issued ID tokens.
- IdP diversity. Enterprise SAML and OIDC providers behave differently. Auth0 hides this pain well but you pay for it. Cognito gives you the plumbing but you debug nameID formats, ACS URLs, and clock skew yourself. If you roll your own, budget time for IdP specific mappers and test suites.
- Actions, Rules, and Lambda triggers. These are easy to lean on. They also become proprietary glue. When you leave, you are rewriting business logic. Keep custom logic in a middleware you control and call out via redirects or hooks only for the minimum vendor integration.
- MFA deliverability. SMS filters bite. We saw 6 to 10 percent failure rates for some prepaid carrier ranges during peak promo season. For US traffic we added voice fallback and magic links. Price that in. International SMS costs swing by 10x between regions.
- JWT size. SAML assertions and bloated ID tokens break ALB header limits and some CDNs. If your front door or edge will enforce headers, read our gateway front door guide at /insights/api-gateway-rest-vs-http-vs-alb-vs-nlb-pick-the-right-front-door and set header size budgets early.
- Vendor outages and blast radius. Auth0 had region incidents. Cognito had control plane issues that blocked pool changes. Your mitigation is session length, refresh rotation with jitter, and circuit breakers in your apps. If you do custom, you own multi AZ testing and failover.
Compliance And Audit Reality
- Audit logs. Treat 365 day immutable auth logs as non negotiable. Auth0 log streaming add ons or log pulls into your SIEM are part of TCO. Cognito needs CloudWatch plus a pipe into your lake. Custom needs signed append only logs and a rotation process.
- HIPAA. Auth inside a HIPAA boundary is fine if PHI never sits in vendor hosted custom fields. If you are committing to HIPAA with a vendor, you need a BAA. Auth0 has them at enterprise tiers. Cognito is in scope when you configure it properly on AWS and you still sign a BAA with AWS. We have learned this the hard way across multiple systems. If you want a second set of eyes before you commit to a vendor BAA, our HIPAA systems team at /services/hipaa-systems can outline the shared responsibility line items.
- Data residency. Auth vendors replicate metadata. If your regulator requires data to stay in a region, test and document it. Custom domains and log sinks often cross region. Your DPA will call this out during review.
Migration And Exit Costs You Should Model Up Front
- Passwords. If you do not control the password hashes, you need just in time migration. That means running both identity stacks for at least 30 to 60 days and handling token minting from either. Price the double run.
- Token verification. Change in JWKS URL, kid rotation policies, and alg defaults can break downstream services. Stage a parallel JWKS that proxies vendor keys to keep consumer services pinned to your domain.
- Org and tenant model. Auth0 Organizations is not portable. Cognito has limited first class org support. If you have B2B, keep org membership in your app database and map it at login via custom claims from your system. That keeps migration surface small.
- Admin UX and helpdesk. Your CS tools and flows must be rebuilt when you switch. Password reset, account lock, impersonation, and session revoke are the tickets that flare up. Budget two weeks to rebuild helpdesk tooling.
If you want this planned as a formal risk register with exit criteria and kill switches, that is exactly the scope of our vendor stack decisions service at /services/vendor-stack-decisions and our architecture review work at /services/architecture-review.
When I Would Pick Each Path
Auth0
- You need enterprise SSO and organizations in Q2, not Q4. You can afford the per MAU premium. You want fast pace on OIDC and SAML edge cases. Your team count is small and you value time to market over unit cost.
Cognito
- You run mostly on AWS and want the lowest unit cost with acceptable engineering friction. You can own the UX details and the helpdesk tooling. You do not need the full enterprise SSO buffet on day one.
Custom or open source core
- You need strict data residency, specialized login flows, or regulated controls the vendors cannot sign for. You have at least one senior engineer who has built identity and you are ready to own the pager. Consider starting from Ory, ZITADEL, or Keycloak to reduce scope.
If you are unsure, run a two week spike with a reference slice. One SPA, one API, SMS MFA, refresh rotation, and a partner SAML login. Measure the build time and copy actual costs into the calculator above. That is cheaper than debating it for a month.
What I Would Do Differently Next Time
- Keep auth vendor logic out of Actions and Lambda triggers. Put policy in a small gateway we own. Call the vendor only for token minting and provider federation.
- Normalize tokens immediately at the edge. Issue a short lived first party session token with only standard claims. Hide vendor specifics from downstream services.
- Model SMS deliverability by region early. Ship email and voice fallbacks in the same sprint as SMS MFA. It saves a pager later.
- Budget for an audit log store on day one. Do not rely on vendor consoles for investigations. Stream every login, token, and admin action into your lake with a 365 day retention.
Reading Your Model Like A CFO
- Unit cost. Dollars per successful login, not just per MAU. Vendors that seem cheap per MAU can look expensive per login when sessions are short.
- CAC payback sensitivity. If auth cost per activated user per month is above two percent of your ARPU, you will revisit this choice inside a year. Use the calculator to fit to your ARPU curve.
- Variability. SMS spikes with growth marketing. Add a 1.5x multiplier for promo months in your model or you will get a surprise line item.
If you want a second opinion on the model, or you need someone to own the first migration, we can fold it into an architecture review at /services/architecture-review or a short vendor decision sprint at /services/vendor-stack-decisions. If you are crossing into PHI or finance, loop in our HIPAA systems folks at /services/hipaa-systems early. If your identity layer touches API gateways or you are reworking the front door, use our gateway guide at /insights/api-gateway-rest-vs-http-vs-alb-vs-nlb-pick-the-right-front-door to avoid header and cookie pitfalls.



