title: How do I setup email configuration for aws cognito user pools?
body: <p>I am not sure how to setup the "EmailConfiguration" part of the serverless cloudformation resource section. Does anyone have an example on how to do this? Any guidance would be much appreciated!</p>
  
  <p>Here is my serverless.yml file.</p>
  
  <pre><code>service: cognito-email-config
  provider:
    name: aws
    runtime: nodejs6.10
    region: us-east-1
  
  plugins:
    - serverless-stack-output
  
  custom:
    output:
      handler: serverless/output.handler
      file: outputs/stack.json
  
  functions:
    preSignUp:
      handler: serverless/preSignUp.handler
    postConfirmation:
      handler: serverless/postConfirmation.handler
  
  resources:
    Resources:
      SESRole:
        Type: "AWS::IAM::Role"
        Properties:
          AssumeRolePolicyDocument:
            Version: "2012-10-17"
            Statement:
              - Effect: "Allow"
                Principal:
                  Service:
                    - "cognito-idp.amazonaws.com"
                Action:
                  - "sts:AssumeRole"
          Policies:
            - PolicyName: "CognitoSESPolicy"
              PolicyDocument:
                Version: "2012-10-17"
                Statement:
                  - Effect: "Allow"
                    Action:
                      - "ses:SendEmail"
                      - "ses:SendRawEmail"
                    Resource: "*"
      CognitoUserPool:
        Type: "AWS::Cognito::UserPool"
        Properties:
          UserPoolName: ${env:COGNITO_USER_POOL}
          EmailConfiguration:
            ReplyToEmailAddress: admin@example.com
            SourceArn:
              Fn::GetAtt: [SESRole, Arn]
          AutoVerifiedAttributes:
            - phone_number
          MfaConfiguration: "OPTIONAL"
          SmsConfiguration:
            ExternalId: ${env:COGNITO_USER_POOL}-external
            SnsCallerArn:
              Fn::GetAtt: [SNSRole, Arn]
          Schema:
            - Name: name
              AttributeDataType: String
              Mutable: true
              Required: true
            - Name: email
              AttributeDataType: String
              Mutable: false
              Required: true
            - Name: phone_number
              AttributeDataType: String
              Mutable: false
              Required: true
  </code></pre>
  
  <p>after running that i get this error...</p>
  
  <pre><code>Serverless: Deployment failed!
  
    Serverless Error ---------------------------------------
  
    An error occurred while provisioning your stack: CognitoUserPool - Email arn does not belong to your account. (Service: AWSCognitoIdentityProvider; Status Code: 400; Error Code: NotAuthorizedException; Request ID: f2b14a38-82a1-11e7-8ea0-eb271a42c298).
  
    Get Support --------------------------------------------
       Docs:          docs.serverless.com
       Bugs:          github.com/serverless/serverless/issues
       Forums:        forum.serverless.com
       Chat:          gitter.im/serverless/serverless
  
    Your Environment Information -----------------------------
       OS:                     linux
       Node Version:           8.2.1
       Serverless Version:     1.20.0
  
  ERROR: Job failed: exit code 1
  </code></pre>
  
  <p>I don't think I am using "SourceArn" of "EmailConfiguration" properly; I just copied the example from SNS to SES (using the gist below) hoping it would work.</p>
  
  <p>Here is aws documentation reference for the resource that I need setup:
  <a href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-emailconfiguration" rel="noreferrer">http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-emailconfiguration</a></p>
  
  <p>this has helped me as a reference but doesn't show how to use SES:
  <a href="https://gist.github.com/singledigit/2c4d7232fa96d9e98a3de89cf6ebe7a5" rel="noreferrer">https://gist.github.com/singledigit/2c4d7232fa96d9e98a3de89cf6ebe7a5</a></p>