如何在cloudformation中获取认知用户的“用户名”

时间:2018-08-11 14:07:13

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

我创建了一个用户,例如:

  SuperAdminUser:
    Type: AWS::Cognito::UserPoolUser
    Properties:
      DesiredDeliveryMediums:
        - EMAIL
      Username: !Ref SuperAdminEmail
      UserAttributes:
        - Name: email
          Value: !Ref SuperAdminEmail
      UserPoolId:
        Fn::ImportValue:
          !Sub ${BaseStack}-Cognito

然后定义了用户池:

  CognitoUserPool:
    Type: AWS::Cognito::UserPool
    Properties:
      AdminCreateUserConfig:
        AllowAdminCreateUserOnly: false
        UnusedAccountValidityDays: 3
      LambdaConfig:
        PreSignUp: !GetAtt CognitoPreSignUpHook.Arn
      Policies:
        PasswordPolicy:
          MinimumLength: 8
          RequireNumbers: true
      UsernameAttributes:
        - email

我注意到它找不到用户,因为用户名看起来像:9f8aecc2-530d-411d-8d73-c3b775da1893,而在这种情况下!Ref给出了用户的电子邮件。我发现添加

时这开始失败
      UsernameAttributes:
        - email

我该如何解决?我注意到用户资源不允许我获取用户的Sub ...

0 个答案:

没有答案