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.

질문됨 2년 전421회 조회
1개 답변
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
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인