我正在尝试使用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
答案 0 :(得分:7)
CloudFormation尚不支持使用新的SignUp流选项配置用户池的功能。用于指定仅限电子邮件或电话号码选项的参数为UsernameAttributes。
我们会将此作为+1添加到功能请求中,以便通过CloudFormation支持此功能。
答案 1 :(得分:0)
现在通过CloudFormation支持使用新的SignUp流选项配置用户池的功能。
UserPool:
Type: AWS::Cognito::UserPool
Properties:
UsernameAttributes:
- email
答案 2 :(得分:-1)
您需要设置AliasAttributes
。
AWS::Cognito::UserPool -> AliasAttributes
这是一个示例CloudFormation模板:
AWSTemplateFormatVersion: '2010-09-09'
Resources:
UserPool:
Type: AWS::Cognito::UserPool
Properties:
AliasAttributes:
- email
UserPoolName:
Ref: AWS::StackName