Amazon Cognito: CreateAdminUser

A quick reminder for next time I use CreateAdminUser:

For new users:

  • if MessageAction is set to RESEND, creation will fail with a UserNotFoundException.
  • if MessageAction is set to SUPPRESS, creation will succeed, and the email will be sent.
  • if MessageAction is not included, creation will succeed, and the email will be sent.

For existing users:

  • if MessageAction is set to RESEND, the user record will be returned and the email will send. UserLastModifiedDate will not equal UserCreateDate
  • if MessageAction is set to SUPPRESS, a UsernameExistsException is returned.
  • if MessageAction is not included, a UsernameExistsException is returned.

So, the default value is SUPPRESS. I want to error on existing users, so I can use the default. RESEND is only needed if I want to resend the confirmation, which I should set up a separate call: create_user vs resend_confirmation.

Laura Ann Williams (law)

Coding Ruby, Elixir & GraphQL.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade