https://serverless-stack.com/ logo
#sst
Title
# sst
i

Ivan Roskoshnyi

05/04/2022, 12:46 PM
Hello everyone. Is there a way to import users from an existing cognito user pool to a new one using
SST
?
o

Omi Chowdhury

05/04/2022, 2:52 PM
If you want to use the auth construct you can use this example: https://docs.serverless-stack.com/constructs/Auth#importing-an-existing-user-pool Otherwise you can use a raw UserPool directly from CDK
i

Ivan Roskoshnyi

05/04/2022, 3:00 PM
@Omi Chowdhury Done but unfortunately users haven't been imported
it doesn't work
o

Omi Chowdhury

05/04/2022, 3:01 PM
oh you mean copy the users over…I think you’ll have to write soe code to run a migration. Similar strategy to a db migration
i

Ivan Roskoshnyi

05/04/2022, 3:02 PM
Well...I found some tools how to export users from an existing pool but have no idea to to import them into a new one
a

Adam Fanello

05/04/2022, 3:04 PM
Note that any export will not include passwords. All users will have to go through a forgot password flow to regain access.
i

Ivan Roskoshnyi

05/04/2022, 3:05 PM
@Adam Fanello Yeah, I know. This is not a problem. But the main problem remains...
b

Brett Fieber

05/04/2022, 3:37 PM
Useful package which includes backing up users and groups: https://github.com/mifi/cognito-backup
i

Ivan Roskoshnyi

05/04/2022, 3:40 PM
@Brett Fieber Yeah, I saw it. But it doesn't support
csv
and bad work with JSON
b

Brett Fieber

05/04/2022, 3:41 PM
Unless you're planning to massage the data between backup & restore, does it really matter what the interim data format is?
i

Ivan Roskoshnyi

05/04/2022, 3:43 PM
You are right. I mean if we talk about full covering of the issue: backup & transmit users to another pool, then it doesn't work