【问题标题】:AWS Cognito General Attribute settings using Cloud formation使用云形成的 AWS Cognito 常规属性设置
【发布时间】:2020-08-09 05:40:55
【问题描述】:

我是 AWS 的新手,我正在尝试创建一个新的用户池,我想使用 Cloud Formation 实现以下突出显示的设置。你能指出我实现这一目标的正确方向吗?

【问题讨论】:

    标签: amazon-web-services amazon-cloudformation amazon-cognito


    【解决方案1】:

    请在此基础上为您改一点。这是我正在使用的,已经非常接近您的要求了。

    AWSTemplateFormatVersion: 2010-09-09
    Description: >
      AWS CloudFormation template to create core infrastructure
    Parameters:
      Product:
        Type: String
        Default: "your-product-name"
    Resources:
        UserPool:
            Type: AWS::Cognito::UserPool
            Properties:
              UserPoolName: !Join ["-", [!Ref Product, "user-pool"]]
              AutoVerifiedAttributes:
                - email
              Schema:
                - AttributeDataType: "String"
                  Mutable: true
                  Name: "email"
                  Required: true
                - AttributeDataType: "String"
                  Mutable: true
                  Name: "family_name"
                  Required: true
                - AttributeDataType: "String"
                  Mutable: true
                  Name: "given_name"
                  Required: true
              UsernameAttributes:
                - email
              AccountRecoverySetting:
                RecoveryMechanisms:
                  - Name: verified_email
                    Priority: 1
              AdminCreateUserConfig:
                AllowAdminCreateUserOnly: False
              UsernameConfiguration:
                CaseSensitive: false
              Policies:
                PasswordPolicy:
                  MinimumLength: 6
                  RequireLowercase: false
                  RequireNumbers: false
                  RequireSymbols: false
                  RequireUppercase: false
                  TemporaryPasswordValidityDays: 30
              DeviceConfiguration:
                ChallengeRequiredOnNewDevice: false
                DeviceOnlyRememberedOnUserPrompt: false
              VerificationMessageTemplate:
                DefaultEmailOption: CONFIRM_WITH_LINK
              UserPoolTags:
                product: !Ref Product
    

    如果您需要更多,请发表更多评论。

    【讨论】:

    【解决方案2】:

    将电话号码设置为用户名:

    UsernameAttributes:
      - phone_number
    

    并将电话号码设置为必需属性:

    Schema:
      - Name: email
        AttributeDataType: String
        Required: true
        Mutable: true
    

    您可以参考https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html获取详细信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-31
      • 2021-10-07
      • 2021-08-24
      • 2018-08-02
      • 1970-01-01
      • 2017-05-21
      • 2018-02-28
      • 2019-04-30
      相关资源
      最近更新 更多