RealmDeployDocs
Migration

Moving from Amazon Cognito

List Cognito users and groups, convert them for Keycloak, and re-create app clients and identity providers. Password users set a new password by email link.

Passwords do not move. Cognito does not export passwords or hashes. Password users set a new password by email link after the move.

1. Export users and groups

Cognito has an import job but no export job, so list users with the AWS CLI. It follows the pagination for you:

aws cognito-idp list-users --user-pool-id <pool-id> --output json > users.json

For groups, run aws cognito-idp admin-list-groups-for-user per user (or list-users-in-group per group). To bring groups along, build a CSV with Cognito's attribute names as the header and a groups column.

2. Convert

Open the Cognito to Keycloak users converter. It reads the list-users JSON or the CSV, including Cognito's \, for a comma inside a value. It writes:

  • email, emailVerified, names, enabled and createdTimestamp
  • custom:<name> as the <name> attribute, standard attributes such as phone_number under their own names, and sub as cognito_sub
  • groups from the column you name
  • UPDATE_PASSWORD for every user except federated ones (usernames such as Google_…, status EXTERNAL_PROVIDER)

Keycloak gives each user a new id. If your backend keys data on sub, map cognito_sub into tokens or look users up by it.

3. Re-create the rest

In CognitoIn Keycloak
App clientClient with the same callback URLs and scopes
Hosted UIKeycloak's sign-in pages, in its own theme
Resource servers and custom scopesClient scopes
Social and SAML identity providersIdentity providers; register the new redirect URI
Lambda triggersMappers, required actions or application code
MFA (TOTP, SMS)Users enroll again; Keycloak has no built-in SMS codes

4. Dry run, then cut over

Import into a staging realm with partial import and sign in through each app. At cut-over, stop sign-ups in Cognito, export again, import, switch the apps and send the set-password emails in batches. Keep the user pool unchanged until you sign the move off.

The Cognito migration page covers what each plan includes.

On this page