What are the pros and cons of using Cognito-id (Cognito sub) as a primary key?

0

I am currently building a Django app that uses AWS Cognito for auth.

I am having a hard time understanding the pros and cons of using Cognito-sub as the primary key for my user table versus using a generic uuid4 + cognitio_id field.

What are some edge cases that might make this a bad idea? One thing came to mind is if I accidentally deleted my Cognito User Pool it would be very hard to recover my user db.

demandé il y a 2 ans427 vues
1 réponse
0

Hi,

You have basically identified the primary reason not to use the Sub attribute. If you need to migrate user pools, replicate users to another region, restore expected users, etc. the sub would be different so therefore it's typically a bad idea to use it as a key. A UUID with the Cognito ID provides more protection against this. The only downside of this is that you still have to create the unique key yourself but it avoids any issues in the event you have to recover the pool.

Thanks, Owen

AWS
Owen
répondu il y a 2 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions