title: Amazon Cognito User Pool - using the "username" attribute to store custom user IDs
body: <p>In <strong>Amazon Cognito</strong>'s User Guide, in the page “<a href="https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html" rel="nofollow noreferrer">Configuring User Pool Attributes</a>”, there is this paragraph (with added emphasis):</p>
  <blockquote>
  <p>“If your application does not require a username, you do not need to ask users to provide one. <strong>Your app can create a unique username for users in the background</strong>. This is useful if, for example, you want users to register and sign in with an email address and password.”</p>
  </blockquote>
  <p>I want to do precisely what the paragraph says: while users sign up, create in the background a custom user ID for them myself, because I need these IDs to follow a specific semantic format, that embeds tenant context into the IDs (something like “T01234#U01234567“, meaning “user U01234567 inside of tenant T01234”).</p>
  <p>The users won't know of their custom ID, they will feel as they've signed up (and later signed in) with their emails (or through 3rd parties like Facebook and Google, if possible in this set up). But in the background I will create these custom IDs and store them in their <code>username</code> attribute in the User Pool.</p>
  <p>The reason I want to store these iDs specifically in the <code>username</code> attribute is because it is un-mutable and unique, but most important because I will need to query <a href="https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_Operations.html" rel="nofollow noreferrer">Cognito's APIs</a> (ListUsers, AdminListGroupsForUser, etc.) using these custom IDs as filter, to give my customers some user management capabilities. The <code>username</code> attribute is the parameter for these APIs. Therefore, I cannot use User Pool custom attributes here, since they are not accepted as parameters of these APIs.</p>
  <p>The reason I post this Question is because, while the documentation recommends this as a possible setting, there is no specific information on how to set the user pools and sign up flow to support this specific use case.</p>
  <p>What is the general settings layout of this? To start with, in the option “<strong>How do you want your end users to sign-up and sign-in?</strong>”, what do I have to put there in the scenario I described? If anyone can give any additional pertinent information, it would be very helpful, as the documentation feels somewhat opaque.</p>
  <p>Thank you very much for those who've read this.</p>