Skip to content

Does Amazon Cognito User Pools guarantee that a sub value is never reassigned after the original user is deleted?

0

I am evaluating Amazon Cognito User Pools for an application that uses the OIDC pair (iss, sub) as the durable external identity key.

AWS documentation states that the Cognito sub attribute is unique within a User Pool and has a fixed value for an existing user.

My question is specifically about historical non-reassignment after account deletion, not only uniqueness among currently existing users.

Within the same Amazon Cognito User Pool / same OIDC issuer:

  1. After a user is deleted with DeleteUser or AdminDeleteUser, can the exact sub value previously issued to that deleted user ever be assigned to another user account in the future?

  2. Is the following a supported Cognito guarantee that applications may rely on?

"Once a Cognito sub value has been issued to a user, that exact sub value will never be reassigned to a different user under the same User Pool / issuer, including after the original user is deleted."

  1. If a new account is later created with the same username, email address, phone number, aliases, or other profile metadata as the deleted user, is the new account guaranteed to receive a different sub?

  2. Is permanent non-reassignment of previously issued sub values part of the supported Cognito identity semantics, or only a current implementation detail?

If this guarantee is documented publicly, please provide the relevant official AWS documentation reference.

I am specifically trying to distinguish between:

  • uniqueness among current users;
  • a fixed sub during one user's lifetime; and
  • permanent historical non-reassignment after deletion.
1 Answer
0

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.

answered a month ago

EXPERT

reviewed 5 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.