- Newest
- Most votes
- Most comments
Based on the current Amazon Cognito documentation, AWS does not appear to document a guarantee of permanent historical non-reassignment of a sub after the user is deleted.
The documented guarantees are narrower:
sub is described as a unique user identifier within a user pool.
AWS says the sub has a fixed value for the user.
AWS recommends using sub as the identifier for a given user, rather than mutable attributes such as email or phone number.
DeleteUser permanently deletes the user's profile.
However, I cannot find an AWS statement saying:
Once a sub has been issued, that value is permanently reserved and can never be assigned to another user in that user pool, even after the original user is deleted.
That distinction is important. “Unique within each user pool” and “fixed value” do not, by themselves, establish an indefinite historical non-reuse guarantee after deletion.
I also would not infer such a guarantee from the fact that Cognito currently generates UUID-like values. The documented semantics are what matter, not the current implementation.
Therefore, if the application's security/data model requires the stronger invariant that:
(issuer, sub) is globally unique for all users that have ever existed
I would not treat that as a documented Cognito contract unless AWS Support provides an explicit assurance.
In particular, if user A is deleted and a new user B is subsequently created with the same username, email, phone number, aliases, etc., Cognito's documentation supports treating B as a new user with its own sub; but I cannot find public AWS documentation that makes permanent non-reuse of A's exact sub a supported guarantee.
So I would distinguish the three cases exactly as follows:
Unique among current users: documented.
Fixed for the lifetime of a user: documented.
Never reassigned after deletion: not documented as a supported Cognito guarantee, as far as I can find.
If permanent historical uniqueness is a hard requirement, I would retain the original (iss, sub) in your own durable identity/history table rather than relying on an undocumented non-reuse property of Cognito.
