如何使用 cloudformation 在 AWS cognito 上设置验证属性?

问题描述

我正在尝试使用 cloudformation 在 cognito 用户池上设置验证属性,并且我已经来回浏览文档有一段时间了,但我找不到正确的设置。

更清楚地说,这就是我想要改变的:

enter image description here

我当前的 yaml 文件如下所示:

UserPool:
Type: AWS::Cognito::UserPool
Properties:
  AdmincreateuserConfig:
    AllowAdmincreateuserOnly: false
  UserPoolName: !Sub ${AWS::StackName}-UserPool
  UsernameAttributes:
    - email
  AccountRecoverySetting:
    RecoveryMechanisms:
      - Name: verified_email
        Priority: 1
  VerificationMessageTemplate:
    DefaultEmailOption: CONFIRM_WITH_LINK
  Policies:
    PasswordPolicy:
      MinimumLength: 8
      RequireLowercase: true
      RequireNumbers: true
      RequireSymbols: true
      RequireUppercase: true
      TemporaryPasswordValidityDays: 7

有没有办法在 cloudformation 中做到这一点?

解决方法

只需将 AutoVerifiedAttributes 属性值设置为 [] - 一个空列表

示例:

Resources:
  CUP1FD5E:
    Type: AWS::Cognito::UserPool
    Properties:
      UserPoolName: SIMPLE
      UsernameAttributes:
        - email
      # empty list
      AutoVerifiedAttributes: []