Managing multiple Keycloak configurations doesn’t have to mean endless exports, manual edits, or brittle scripts. You can borrow the simplicity of AWS CLI-style profiles — short names, clear separation, and instant switching — and bring that same power to Keycloak. With this, you can connect to multiple realms, clients, or accounts without touching your base configuration. No more fiddling with JSON every time you need to test against staging, QA, or production.
Why AWS CLI-Style Profiles Work for Keycloak
Profiles keep secrets and settings siloed. They define everything you need: server URL, realm, credentials, and client configuration. Each profile lives as its own block. You call them on demand with a single flag. Keycloak admins using profiles can rotate between projects without logging out or opening another terminal window. Teams stop overwriting each other’s configs.
Setting Up AWS CLI-Style Profiles in Keycloak
Create a .keycloak/config file to store your profiles. Use a clean, readable format. Each profile should contain:
auth-server-urlrealmclient-idclient-secretorusername/password
Give each one a clear name, like dev, staging, or prod.