Skip to main content
This guide moves the user records in an AWS Cognito user pool into Databunker Pro. For the phases and mechanics shared by every migration, see the migration overview. For why teams replace Cognito with an auth library plus a PII vault, see AWS Cognito vs Databunker Pro.
Cognito does not export password hashes. There is no API that returns them, so no migration can carry passwords across. Every user must either set a new password once, or sign in through a federated provider. Plan the migration around that constraint — it drives the timing of every other step.

What moves where

Cognito is doing two jobs: authenticating users, and storing their attributes. Databunker Pro replaces only the second.

Before you start

  • A running Databunker Pro instance and a root or admin access token.
  • A license whose record cap covers your user count.
  • AWS credentials with cognito-idp:ListUsers on the pool.
  • pip install databunkerpro boto3
  • Your replacement auth layer built and tested, but not yet live.

No mapping table needed

Unlike a SQL users table migration, there is nothing here to keep in step with the vault. Cognito’s sub goes into the indexed custom field, so any user can be resolved directly:
The token belongs on your new auth layer’s user row — next to the password hash and MFA secret — and that row is created when the user first signs in, not now. So this migration writes only to the vault.

Step 1: Export and import

ListUsers returns at most 60 users per page and is throttled, so the export is usually the slow part — not the import. The script runs in two phases: page through the whole pool first, then import the result in chunks of 1,000 via UserCreateBulk. Cognito returns attributes as a list of name/value pairs, so they are flattened first, then mapped onto the fields Databunker Pro indexes: Everything else is carried across unchanged, including custom:* attributes.
Cognito allows two accounts to hold the same email when the pool is not configured to require uniqueness. Databunker Pro enforces uniqueness per tenant, so the second one is rejected with Duplicate email value and appears in cognito-errors.csv. Decide which account survives before cutting over.

Groups

If you use Cognito groups, export them separately — ListUsersInGroup per group is far cheaper than one AdminListGroupsForUser call per user:

Step 2: Verify

1

Counts match

SystemGetSystemStatstotalnumrecords should have grown by the pool’s user count, less anything in cognito-errors.csv.
2

Spot-check detokenization

Because sub went into custom, any user resolves by their Cognito id directly.
3

Re-run to catch stragglers

Users created in Cognito while the export was running will have been missed. Re-run the script — already-migrated records come back as Duplicate custom value in the error CSV, and only the new ones are added.

Step 3: Cut over authentication

This is the step that affects users, so it is worth staging.
1

Point the new auth layer at Databunker Pro

Sign-in looks the user up by email, reads the profile from the vault by token, and issues your own session. No Cognito call remains in the path.
2

Trigger the password reset

Email every user a one-time reset link. Send in waves rather than all at once, so support load and email-reputation damage stay manageable.
3

Keep Cognito readable during the transition

Leave the pool in place but stop writing to it. If something is missing you can still read it, and users who have not reset yet can be identified from cognito_status in their vault profile.
Federated users — Google, Apple, SAML — need no password reset. Their identity lives with the external provider, so re-pointing your auth layer at the same provider signs them straight back in. Migrating those users first shrinks the population that needs a reset email.

Step 4: Decommission the pool

Once the reset campaign has run its course and Cognito has served no sign-ins for a full business cycle, delete the user pool.
Deleting a Cognito user pool is immediate and irreversible, and there is no export of what it held. Confirm every user is in the vault first, and keep a copy of your export output until you are certain.

Working with the vault afterwards

The calls that replace the Cognito operations you were making before. Every one of the four indexed fields — email, phone, login, custom — works as a lookup key, so you rarely need the token itself. Sign-in: look a user up by email
Replaces AdminGetUser. The same call works with "phone", "login", or "custom" — use custom when you hold the Cognito sub:
Update a profile
Replaces AdminUpdateUserAttributes. Only the fields you pass are changed. Delete a user (right to erasure)
Replaces AdminDeleteUser — but unlike Cognito this erases the personal data itself, since it lived only in the vault. The audit trail records the deletion without retaining the data. Check whether someone exists, without reading their data
Useful during the reset campaign, where you want to know whether an address belongs to a migrated user before sending mail to it.
UserGet returns 404 for an unknown identity, so treat a non-ok status as “not found” rather than an error. Every call is written to the audit trail, including the ones that find nothing.

Rolling back

Next steps