配置 Cognito 用户池以使用位于 ap-southeast-2 的 SES 发送电子邮件

Pab*_*blo 5 amazon-ses aws-cloudformation serverless-framework

我有以下 cloudformation 模板(它是 serverless.yml 模板的一部分)来创建使用 SES 发送电子邮件的 Cognito UserPool。

我正在 ap-southeast-2 上部署我的无服务器项目,并且我想使用同一区域发送电子邮件。我已在 ap-southeast-2 中预先验证了 SES 模板中的帐户,但如果我将下面模板(最后一行)中的 SourceArn 替换为ap-southeast-2(或无服务器伪变量#{AWS::Region})区域,则会收到错误:

An error occurred: CognitoUserPool - Unable to send email message, please try again (Service: AWSCognitoIdentityProviderService; Status Code: 400; Error Code: InvalidParameterException; Request ID: ...).

us-west-2当我用(如下面的模板中所示)替换该区域时,它就起作用了。ap-southeast-2如果允许我使用该地区的 SES,为什么不支持?

  CognitoUserPool:
    Type: AWS::Cognito::UserPool
    Properties:
      # Generate a name based on the stage
      UserPoolName: ${self:provider.stage}-user-pool
      # Set email as an alias
      AutoVerifiedAttributes:
        - email
      # UsernameAttributes and AliasAttributes are mutually exclusive configuration options
      AliasAttributes: # instead of UsernameAttributes:
        - preferred_username
        - email
      UsernameConfiguration:
        CaseSensitive: false
      AccountRecoverySetting:
        RecoveryMechanisms:
          - Name: verified_email
            Priority: 1
      AdminCreateUserConfig:
        UnusedAccountValidityDays: 5
        AllowAdminCreateUserOnly: false
      Policies:
        PasswordPolicy:
          MinimumLength: 10
          RequireLowercase: true
          RequireNumbers: true
          RequireSymbols: true
          RequireUppercase: true
      Schema:
        - Name: membershipType
          Required: false
          Mutable: true
          AttributeDataType: String
      VerificationMessageTemplate:
        DefaultEmailOption: CONFIRM_WITH_LINK
        EmailMessageByLink: "Please click on the following link to verify: {##Verify Email##}"
        EmailSubjectByLink: Please confirm your registration 
      EmailConfiguration:
        EmailSendingAccount: DEVELOPER
        From: my@email.com
        ReplyToEmailAddress: my@email.com
        SourceArn: arn:aws:ses:us-west-2:#{AWS::AccountId}:identity/my@email.com
Run Code Online (Sandbox Code Playgroud)

Mar*_*cin 4

不支持此功能ap-southeast-2。在 AWS 在新区域提供支持之前,我们无法做太多事情。

\n\n

来自文档

\n\n
\n

Amazon SES 的可用区域为美国东部(弗吉尼亚北部)us-east-1、美国西部(俄勒冈)us-west-2 和欧洲(爱尔兰)eu-west-1。Amazon SES不支持在以下区域接收电子邮件:亚太地区(孟买)、亚太地区(悉尼)、加拿大(中部)、欧洲(法兰克福)、欧洲(伦敦)、南美洲(S\xc3\xa3o 保罗) )和 AWS GovCloud(美国)。

\n
\n