Zero-Downtime AWS Cognito User Pool Migration (User Migration Lambda Trigger)

Overview

Using the User Migration Lambda Trigger on a new Cognito user pool enables users to sign-in to a new user pool without having to create a new account or reset their password. The User Migration Lambda runs after failed sign-in attempts and attempts to sign in users against the old user pool during a migration. Following an open-source repository, this blog will guide how to migrate users to a new user pool.

https://github.com/Collaborne/migrate-cognito-user-pool-lambda

Changes I made to the repository

  1. I made sure the event.response.userAttributes object had keys matching the new user pool’s signup attributes (with the same exact spelling).
  2. I added ["custom:<attribute name>"] to the event.response.userAttributes response to add custom attributes to a user in the new user pool.