AWS Cognito - 如何使用CloudFormation创建允许使用电子邮件地址注册的池?

5 amazon-web-services aws-cloudformation amazon-cognito serverless-framework aws-cognito

我正在尝试使用CloudFormation语法创建UserPool,但是我无法找到我需要设置哪个属性才能创建具有电子邮件地址注册的池.我该如何指定?

在此输入图像描述

正如您在屏幕截图中看到的,默认情况下,池是使用用户名创建的.

这是我当前的池配置;

MyPool:
  Type: "AWS::Cognito::UserPool"
  Properties:
    Schema:
      - Name: sub
        StringAttributeConstraints:
          MinLength: '1'
          MaxLength: '2048'
        DeveloperOnlyAttribute: false
        Required: true
        AttributeDataType: String
        Mutable: false
      - Name: name
        StringAttributeConstraints:
          MinLength: '0'
          MaxLength: '2048'
        DeveloperOnlyAttribute: false
        Required: false
        AttributeDataType: String
        Mutable: true
      - Name: updated_at
        NumberAttributeConstraints:
          MinValue: '0'
        DeveloperOnlyAttribute: false
        Required: false
        AttributeDataType: Number
        Mutable: true
    UserPoolName: ${self:provider.environment.PARTNER_POOL}
    EmailVerificationMessage: 'Please click the link below to verify your email address.
        {####} '
    EmailVerificationSubject: Your verification link
    SmsAuthenticationMessage: 'Your authentication code is {####}. '
    DeviceConfiguration:
      ChallengeRequiredOnNewDevice: false
      DeviceOnlyRememberedOnUserPrompt: false
    AdminCreateUserConfig:
      InviteMessageTemplate:
        EmailMessage: 'Your username is {username} and temporary password is {####}. '
        EmailSubject: Your temporary password
        SMSMessage: 'Your username is {username} and temporary password is {####}. '
      UnusedAccountValidityDays: 7
      AllowAdminCreateUserOnly: false
    EmailConfiguration: {}
    AutoVerifiedAttributes:
      - email
    Policies:
      PasswordPolicy:
        RequireLowercase: false
        RequireSymbols: false
        RequireNumbers: true
        MinimumLength: 8
        RequireUppercase: false
    AliasAttributes:
      - email
Run Code Online (Sandbox Code Playgroud)

Che*_*hta 7

CloudFormation尚不支持使用新的SignUp流选项配置用户池的功能.用于指定仅限电子邮件或电话号码选项的参数是UsernameAttributes.

我们会将此作为+1添加到功能请求中,以通过CloudFormation支持此功能.

  • 这事有进一步更新吗?没办法呢?尝试使用无服务器CLI通过Cloudformation处理我的用户池. (3认同)
  • 现在这是可能的。参见/sf/answers/3496662921/ (2认同)