0

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?

1 Answers1

2

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:

  1. User logins with user/password
  2. 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:

  1. User logins with user/password
  2. Server authenticates on cognito, if failed:
  3. Server authenticates password and user to be on MySQL
  4. Server adds user on cognito
  5. 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?

jmsalcido
  • 1,057
  • 11
  • 16