7

Following this guide, it says:

On the Attributes tab, select Email address or phone number and select Allow email addresses.

Which looks like this:

enter image description here

But I'm having trouble accomplishing the same thing with CloudFormation. Tried a couple of the obvious attributes but did not work. Thoughts?

3 Answers 3

11

It's now possible to do this by setting the UsernameAttributes property to an array of strings containing either email, phone_number or both:

Type: AWS::Cognito::UserPool
Properties:
  UsernameAttributes:
  - "email"
  UserPoolName: "test-pool"
2
  • This worked but I couldn't find this in the docs; where did you learn about this?
    – DMor
    Jun 23, 2018 at 23:02
  • 1
    @DMor I think I found a link on their forum that pointed to a beta version of the documentation that isn't yet published on the main site.
    – 0x6C38
    Jun 29, 2018 at 23:25
2

Totally agree with 0x6C38

UserPool:
    Type: "AWS::Cognito::UserPool"
    Properties:
      UserPoolName: "test-pool"
      UsernameAttributes: [email]      
      AutoVerifiedAttributes:
        - email

Note! Only one of the aliasAttributes or usernameAttributes can be set in a User pool.

1

It seems that not possible using CFN. See this thread: https://forums.aws.amazon.com/thread.jspa?threadID=259349&tstart=0

Username attributes is a recently rolled out feature and it will be added in cloudformation templates soon.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.