Table of Contents
Amazon doesn't have any ways of backing up and restore heir AWS Cognito User Pools currently.
cognito-tool is a CLI for backing up and restoring the users. Note: AWS has no way of extracting the passwords of cognito users
This repo is forked from mifi/cognito-backup and added restore features. Package name is changed from cognito-backup to cognito-tool to adapt the new functions which are not only focus on backup tasks
- When restoring, this tool sets the default password to
P@ssw@rd1234to all cognito users. - Cognito user's
sub(The UUID of the cognito user) is unique in aws globally. When restoring, the original sub can't be restored. New sub will be set when restoring.
npm install -g cognito-tool
$ cognito-tool backup-users <user-pool-id> <options> Backup all users in a single user pool
$ cognito-tool backup-all-users <options> Backup all users in all user pools for this account
$ cognito-tool restore <user-pool-id> --file <JSON_users_file> Restore users to user pool
$ cognito-tool backup-users eu-west-1_1_12345
$ cat eu-west-1_1_12345.json
$ cognito-tool backup-all-users eu-west-1_1_12345 --dir 20180326
$ cd 20180326
$ cat eu-west-1_1_12345.json
# Nominate region if not set in environment variable or ~/.aws/credentials
$ AWS_region=ap-southeast-2 cognito-tool backup-all-users ap-southeast-2_123456
$ cognito-tool restore ap-southeast-2_345678 --file eu-west-1_1_12345.json