Cognito 用户池能否将 SES 与经过验证的域而不是经过验证的电子邮件一起使用?

Can a cognito user pool use SES with a verified domain and not a verified email?

Cognito 的用户池采用需要经过验证的电子邮件的 ARN 的电子邮件配置。我可以使用经过验证的域中的任何电子邮件而不是单个经过验证的电子邮件吗?

https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-email.html 我正在查看此文档,但我不确定如何使用 "verified email" 以外的任何内容创建一个用户池,该池不可自动化。我想要的替代方法是自动验证域,然后使用该域中的任何地址。

我们能够通过 CLI 完成此操作。首先,转到您在 SES 中验证的域并添加身份策略。

{
  "Version": "2012-10-17",
  "Statement": [
    {
        "Sid": "",
        "Effect": "Allow",
        "Action": [
            "SES:SendRawEmail",
            "SES:SendEmail"
        ],
        "Resource": "arn:aws:ses:us-east-1:YOUR_ACCOUNT_ID:identity/MYCUSTOM.DOMAIN.COM" <- arn of your SES domain
    }
  ]
}

然后在您的本地计算机上创建一个 json 文件。

{
  "SourceArn": "arn:aws:ses:us-east-1:"accountid":identity/MYCUSTOM.DOMAIN.COM",
  "ReplyToEmailAddress": "no-reply@MYCUSTOM.DOMAIN.COM",
  "EmailSendingAccount": "DEVELOPER",
  "From": "no-reply@MYCUSTOM.DOMAIN.COM"
}

最后 运行 cli 命令

aws cognito-idp update-user-pool --user-pool-id 'us-xxxx-X_XXXXXX' --region 'xx-xxxx-x' --email-configuration file://email.json

在 AWS 控制台中为您的 Cognito 池完成此操作后,您应该会在发件人电子邮件地址 ARN 下看到 SES 域的 ARN,并且您可以在发件人地址字段中指定所需的任何电子邮件。

注意:您这是 prod 中的现有池,您可能需要 运行 以下命令来获取电子邮件配置,以确保您不会覆盖更新文档中所述的任何设置 https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_UpdateUserPool.html.

aws cognito-idp describe-user-pool --user-pool-id 'USER_POOL_ID' --region us-east-1