[CloudFormation] Cognito 사용자 풀 생성하기

tallhyun·2020년 5월 14일
0
AWSTemplateFormatVersion: '2010-09-09'

Resources:
  todoCognito:
    Type: AWS::Cognito::UserPool
    Properties: 
      UserPoolName: "어쩌구"
      UsernameAttributes:
        - email
      AutoVerifiedAttributes:
        - email
      Policies:
        PasswordPolicy: 
          MinimumLength: 6
          RequireLowercase: false
          RequireNumbers: false
          RequireSymbols: true
          RequireUppercase: false
          TemporaryPasswordValidityDays: 7
      VerificationMessageTemplate:
        DefaultEmailOption: 'CONFIRM_WITH_LINK'
        EmailMessageByLink: '{##link##}를 눌러주세요.'
        EmailSubjectByLink: '인증메일 입니다.'

  todoCognitoDomain:
    Type: AWS::Cognito::UserPoolDomain
    Properties: 
      Domain: "도오메에이인"
      UserPoolId: !Ref todoCognito

  todoCongnitoAppClient:
    Type: AWS::Cognito::UserPoolClient
    Properties:
      GenerateSecret: False
      UserPoolId: !Ref todoCognito
    DependsOn: todoCognito

  CognitoIdentityPool:
    Type: AWS::Cognito::IdentityPool
    Properties:
      IdentityPoolName: "mzc-2do-app-IdentityPool"
      # 미인증 로그인 허용 여부
      AllowUnauthenticatedIdentities: false
      # Link to our User Pool
      CognitoIdentityProviders:
        - ClientId:
            Ref: todoCongnitoAppClient
          ProviderName:
            Fn::GetAtt: ["todoCognito", "ProviderName"]

Outputs:
  congnitoID:
    Value: !Ref todoCognito
  congnitoArn:
    Value: !GetAtt todoCognito.Arn
  congnitoClientID:
    Value: !Ref todoCongnitoAppClient

참고: https://docs.aws.amazon.com/ko_kr/AWSCloudFormation/latest/UserGuide/AWS_Cognito.html

profile
보안, 클라우드, 풀스택에 관심이 있습니다.

0개의 댓글