如何使用 CloudFormation 仅允许电子邮件作为用户名别名?

How to allow only email as username alias with CloudFormation?

this guide 之后,上面写着:

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

看起来像这样:

但是我在使用 CloudFormation 完成同样的事情时遇到了问题。尝试了几个 obvious attributes 但没有用。想法?

似乎无法使用 CFN。看到这个线程: 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.

现在可以通过将 UsernameAttributes 属性 设置为包含 emailphone_number 或两者的字符串数组来实现此目的:

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

完全同意0x6C38

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

注意!只能在用户池中设置 aliasAttributes 或 usernameAttributes 之一。