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年前427ビュー
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年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ