HashiCorp Vault / OpenBao
Self-managed HashiCorp Vault or OpenBao (MPL-2.0 fork) with Integrated Raft Storage for secrets management, PKI, and dynamic credentials.
Medium — 25 to 150 peak logins per second
Monthly cost
$472.38
Annual cost
$5,669/year
| Compute | $442.38 |
| Storage | $30.00 |
| Other | $0.00 |
Saves $135.78/mo (29%) across Standard_D4ps_v6.
| Role | Instance | vCPU | GB RAM | Storage |
|---|---|---|---|---|
| Keycloak | 2 × Standard_D4s_v6 | 4 | 16 | 100 GB ssd |
| Database | 1 × Standard_D4s_v6 | 4 | 16 | 200 GB ssd |
This medium sizing supports twenty-five to one hundred fifty peak logins per second for Keycloak workloads deployed on Azure in the westus3 region without high availability enabled. Compute drives the monthly cost at four hundred forty-two dollars and thirty-eight cents, utilizing three Standard_D4s_v6 instances. Disabling high availability removes redundancy across nodes, exposing the environment to potential downtime during infrastructure maintenance.
Share the current URL or copy the Azure Terraform / OpenTofu baseline.
# Compatible with Terraform >= 1.6 and OpenTofu >= 1.6
terraform {
required_version = ">= 1.6.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 4.0"
}
}
}
variable "ssh_public_key" {
description = "SSH public key installed on Linux virtual machines."
type = string
default = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG5vplaceholderreplacebeforeapply00000000000 azureuser@example"
}
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "workload" {
name = "keycloak-westus3-rg"
location = "westus3"
}
resource "azurerm_virtual_network" "workload" {
name = "keycloak-vnet"
address_space = ["10.42.0.0/16"]
location = azurerm_resource_group.workload.location
resource_group_name = azurerm_resource_group.workload.name
}
resource "azurerm_subnet" "workload" {
name = "workload-internal"
resource_group_name = azurerm_resource_group.workload.name
virtual_network_name = azurerm_virtual_network.workload.name
address_prefixes = ["10.42.1.0/24"]
}
# Generated for Azure (westus3) from the current estimate state.
resource "azurerm_network_interface" "keycloak_1_nic" {
count = 2
name = "keycloak-keycloak-1-nic-${count.index + 1}"
location = azurerm_resource_group.workload.location
resource_group_name = azurerm_resource_group.workload.name
ip_configuration {
name = "internal"
subnet_id = azurerm_subnet.workload.id
private_ip_address_allocation = "Dynamic"
}
}
resource "azurerm_linux_virtual_machine" "keycloak_1" {
count = 2
name = "keycloak-keycloak-1-${count.index + 1}"
location = azurerm_resource_group.workload.location
resource_group_name = azurerm_resource_group.workload.name
size = "Standard_D4s_v6"
zone = tostring((count.index % 3) + 1)
admin_username = "azureuser"
network_interface_ids = [azurerm_network_interface.keycloak_1_nic[count.index].id]
admin_ssh_key {
username = "azureuser"
public_key = var.ssh_public_key
}
os_disk {
caching = "ReadWrite"
storage_account_type = "StandardSSD_LRS"
disk_size_gb = 50
}
source_image_reference {
publisher = "Debian"
offer = "debian-12"
sku = "12-gen2"
version = "latest"
}
tags = {
app = "keycloak"
role = "keycloak"
}
}
resource "azurerm_managed_disk" "keycloak_1_data" {
count = 2
name = "keycloak-keycloak-1-data-${count.index + 1}"
location = azurerm_resource_group.workload.location
resource_group_name = azurerm_resource_group.workload.name
storage_account_type = "StandardSSD_LRS"
create_option = "Empty"
disk_size_gb = 100
zone = tostring((count.index % 3) + 1)
}
resource "azurerm_virtual_machine_data_disk_attachment" "keycloak_1_attach" {
count = 2
managed_disk_id = azurerm_managed_disk.keycloak_1_data[count.index].id
virtual_machine_id = azurerm_linux_virtual_machine.keycloak_1[count.index].id
lun = 0
caching = "None"
}
resource "azurerm_network_interface" "database_2_nic" {
count = 1
name = "keycloak-database-2-nic-${count.index + 1}"
location = azurerm_resource_group.workload.location
resource_group_name = azurerm_resource_group.workload.name
ip_configuration {
name = "internal"
subnet_id = azurerm_subnet.workload.id
private_ip_address_allocation = "Dynamic"
}
}
resource "azurerm_linux_virtual_machine" "database_2" {
count = 1
name = "keycloak-database-2-${count.index + 1}"
location = azurerm_resource_group.workload.location
resource_group_name = azurerm_resource_group.workload.name
size = "Standard_D4s_v6"
zone = tostring((count.index % 3) + 1)
admin_username = "azureuser"
network_interface_ids = [azurerm_network_interface.database_2_nic[count.index].id]
admin_ssh_key {
username = "azureuser"
public_key = var.ssh_public_key
}
os_disk {
caching = "ReadWrite"
storage_account_type = "StandardSSD_LRS"
disk_size_gb = 50
}
source_image_reference {
publisher = "Debian"
offer = "debian-12"
sku = "12-gen2"
version = "latest"
}
tags = {
app = "keycloak"
role = "database"
}
}
resource "azurerm_managed_disk" "database_2_data" {
count = 1
name = "keycloak-database-2-data-${count.index + 1}"
location = azurerm_resource_group.workload.location
resource_group_name = azurerm_resource_group.workload.name
storage_account_type = "StandardSSD_LRS"
create_option = "Empty"
disk_size_gb = 200
zone = tostring((count.index % 3) + 1)
}
resource "azurerm_virtual_machine_data_disk_attachment" "database_2_attach" {
count = 1
managed_disk_id = azurerm_managed_disk.database_2_data[count.index].id
virtual_machine_id = azurerm_linux_virtual_machine.database_2[count.index].id
lun = 0
caching = "None"
}
Reference architecture: Keycloak for two-node-medium, version Keycloak current high-availability sizing guidance, retrieved April 13, 2026.
https://www.keycloak.org/high-availability/single-cluster/concepts-memory-and-cpu-sizing
Pricing: Azure pricing snapshot, retrieved November 29, 2026.
Commercial pricing only. GovCloud, sovereign cloud, and discounts beyond those shown are not modelled.
Based on Keycloak's official HA sizing concepts and translated into VM-based planning inputs for self-managed deployments.
Estimate excludes external IdPs, SMTP, user federation backends, separate caching infrastructure, and license costs for any commercial database choice.
Self-managed HashiCorp Vault or OpenBao (MPL-2.0 fork) with Integrated Raft Storage for secrets management, PKI, and dynamic credentials.
Self-hosted Teleport for infrastructure identity, privileged access, Kubernetes access, and audited remote sessions.
Self-managed Confluent Platform 8.x (Apache Kafka 4.x KRaft) for durable event streaming, schema governance, and Connect pipelines.