I have an ios app and when one signs in, the uath happens via cognito(which is in place), additionally since all my user data is in rds mysql, I additionally want it to check if for the user, the email id is present in rds mysql db or not.For this I want to create a user migration lambda trigger.Please let me know if my architecture makes sense?
-
Did you ask this question yesterday under a different account? – jordanm Sep 01 '20 at 18:33
-
You are asking multiple things in a single question. – jmsalcido Sep 01 '20 at 18:37
1 Answers
There are multiple questions in a single question but I will answer anyway:
How do you migrate users? You could just create a single-execution task to migrate your users from your MySQL db to Cognito, the only and biggest problem... could be the password info, I assume that you do not have it on plain text.
You could just send an email to all users about updating their password and give them a unique link to do so.
Another option is to keep that db and table for the users, when a new user logs in, just create/add the user to cognito with the password provided.
I assume that you might have this flow right now:
- User logins with user/password
- Server authenticates password and user to be on MySQL (password should not be in plain text) and returns the user info.
so, you could change it to be:
- User logins with user/password
- Server authenticates on cognito, if failed:
- Server authenticates password and user to be on MySQL
- Server adds user on cognito
- Return user info
And in ... 3 months? or something, you could just drop the DB since you already have most users in cognito.
Answering the about architecture question:
I dont have enough context but seems complicated, why are you changing to cognito, any preference or feature that you want to use?

- 1,057
- 11
- 16