What Keycloak really costs
Keycloak is open source under the Apache License 2.0. You can download it, run it and change it without paying anyone. That makes it easy to think of it as free. It is not. Running Keycloak in production costs money every month, and most of that money is not on the cloud bill.
A production Keycloak needs servers, a database, backups, a way in from the internet, and a way to see when something goes wrong. It also needs people. Someone reads the release notes, tests each upgrade, patches the image and the database, answers the page at night, and fixes things when users cannot sign in.
This page is a guide to those costs. It explains each category, how to find your own numbers, and how the calculator above adds them up. The calculator does not know your prices. Every number in it is an example for you to replace.
The cost categories
The calculator splits the cost of self-hosting into six parts. Five are infrastructure you pay a provider for. The sixth is the time your team spends.
| Category | What it covers | Where to find your number |
|---|---|---|
| Compute | The machines or containers Keycloak runs on, times how many | Your cloud bill, filtered by the tags or the cluster Keycloak uses |
| Database | PostgreSQL or another supported database, often a primary and a replica | The managed database line on the bill, or the VMs you run it on |
| Backups and storage | Database backups, snapshots, disks and the storage that holds them | Storage and backup lines on the bill |
| Load balancer | The load balancer or ingress in front of Keycloak, and its traffic | Network lines on the bill |
| Monitoring and logs | Metrics, dashboards, log storage and alerting | Your monitoring tool’s invoice, or its share of it |
| Engineering time | Upgrades, patching, on-call and incidents, in hours, times an hourly cost | Time tracking, tickets, the on-call schedule and incident reports |
Compute
One Keycloak node is enough to try it. For production, plan at least two, so one can restart or fail while the other keeps people signing in. Each node needs enough memory and CPU for your load. Password hashing takes real CPU time, so a busy sign-in hour needs more than a quiet one.
If Keycloak runs on a shared Kubernetes cluster, count its share of the cluster, not the whole cluster. If it has machines of its own, count those machines.
Database
Keycloak keeps realms, clients, users and, since version 26, user sessions in its database. The database is the one part you cannot lose. You might run a managed PostgreSQL with a replica, or two instances of your own. Count both. If the database is shared with other systems, count Keycloak’s share.
Backups and storage
Backups are cheap to store and expensive to forget. Count the backup storage, the disk snapshots and any copies kept in a second region. A backup you have never restored is a guess, so count the time to test a restore in the engineering hours too.
Load balancer
Keycloak sits behind a load balancer or an ingress controller that ends TLS and spreads traffic across the nodes. Cloud load balancers charge by the hour and by the traffic. If one load balancer serves many systems, count Keycloak’s share. The reverse proxy helper shows the settings Keycloak needs behind one.
Monitoring and logs
You need to know when sign-in is slow or down before your users tell you. That means metrics, alerts and logs, and somewhere to keep them. Keycloak serves health checks and metrics on its management port; the health and metrics helper gives you the URLs and probes.
Engineering time
For a small or medium setup, the time your team spends can cost more than the machines. It is also easy to leave out, because nobody sends an invoice for it. The calculator asks for four kinds of time.
Upgrades
Keycloak moves fast. The official upgrading guide lists nine minor releases in the 26 line alone, from 26.0 to 26.8, each with its own migration notes, and patch releases in between. Many notes need action: a renamed option, a changed default, a theme that renders differently, a database migration that takes a while on a large table.
An upgrade means reading those notes, trying the new version on a copy of your setup, backing up the database, rolling out and checking afterwards. The upgrade risk checker lists the notes between two versions so you can see how much there is to read.
Patching
Keycloak is only one layer. Below it are the container image or the operating system, the Java runtime, the database engine and the load balancer. Each gets security fixes. Someone has to notice them, apply them and check that sign-in still works.
On-call
If Keycloak is down, nobody signs in to anything that depends on it. So someone has to be reachable when it breaks. Count the hours you pay for that: an on-call allowance, or Keycloak’s share of a rotation that covers several systems.
Incidents
Things go wrong: a certificate expires, the database fills up, a node runs out of memory, a change in the admin console locks people out. Look at the last six or twelve months of incident reports or tickets about sign-in, and take the monthly average.
The hourly cost
Use the fully loaded cost of an engineering hour, not the salary alone. That includes taxes, benefits, equipment and overhead. If you do not know it, ask finance. The calculator multiplies every hour by this number.
How the calculator adds it up
The sums are simple, and you can check every one of them on the page.
infrastructure = nodes × price per node
+ database instances × price per instance
+ backups and storage
+ load balancer
+ monitoring and logs
engineering = (upgrades + patching + on-call + incidents hours)
× cost of an engineering hour
self-hosting = infrastructure + engineering (a month)
plan = the plan’s price, billed monthly or yearly
break-even = (plan − infrastructure) ÷ cost of an engineering hourYearly totals are the monthly totals times twelve. For a plan billed yearly, the calculator uses its monthly price when billed yearly. Starter is billed monthly only.
Reading the break-even
The break-even is a number of engineering hours a month. Below it, self-hosting costs less than the plan you picked. Above it, self-hosting costs more.
It is often a small number. If your infrastructure costs a few hundred dollars a month and an engineering hour costs around a hundred, a handful of hours a month closes the gap. Ask how many hours your team really spent on Keycloak last month, and the month before.
If your infrastructure alone costs more than the plan, the calculator says so. Then no amount of saved time changes the answer for that plan.
What the calculator leaves out
It compares running costs. Some costs do not fit a monthly line, so they are not in the sums. Keep them in mind.
- The one-time work of building a production setup: the cluster, the database, backups, monitoring, the image and the deployment pipeline.
- Moving from one setup to another, whichever way you go.
- Learning time when the person who knows Keycloak leaves.
- Security reviews and audits that ask how Keycloak is run.
- The cost of an outage to your business, which can be far larger than the hours spent fixing it.
Some work stays with you either way. Realm configuration, clients, identity providers, themes and connecting your applications take your team’s time whether you run Keycloak yourself or not. Leave that time out of the hours, so both sides compare the same thing.
Finding your own numbers
- Open the last three months of your cloud bill and find every line Keycloak uses. Tags or a separate account make this easier.
- Take the monthly average for compute, database, backups, load balancer and monitoring.
- List the Keycloak upgrades and patches of the last year and estimate the hours each took, testing included. Divide by twelve.
- Add the on-call hours you pay for, or Keycloak’s share of them.
- Count the incidents that touched sign-in in the last year and the hours spent on them. Divide by twelve.
- Ask finance for the fully loaded cost of an engineering hour.
If you have not run Keycloak in production yet, you have no history. Use your team’s experience with similar systems, and plan to check the numbers again after a few months.
When self-hosting makes sense
Running Keycloak yourself is a fair choice in some cases. A platform team that already runs many stateful services may add Keycloak with little extra effort. Some rules require that every system runs inside your own network. Very large or unusual setups may need control a managed plan does not offer.
A managed plan makes sense when Keycloak is important but not your core work. Then the hours spent on upgrades and on-call are hours not spent on your product. Our plans include a dedicated Keycloak with its own database, backups, managed upgrades and written support, on the cloud and region you choose. See the plans and prices for what each one includes.
Common mistakes
- Counting only the cloud bill. The hours can be the larger part.
- Counting one node. Production needs at least two to survive a restart.
- Forgetting the database replica, the backups or the second region.
- Using the salary as the hourly cost. Use the fully loaded cost.
- Counting realm and client configuration as running cost. You do that work either way.
- Trusting the example numbers. They are placeholders, not prices.
How to use it
- Replace the number of nodes and the price per node with your own.
- Do the same for the database, backups, load balancer and monitoring.
- Enter the hours a month for upgrades, patching, on-call and incidents.
- Enter the fully loaded cost of an engineering hour.
- Pick the plan to compare with and whether it is billed monthly or yearly.
- Read the monthly and yearly totals, the difference and the break-even hours.
Nothing you type leaves your browser. Use Reset to examples to start again.