我正在尝试构建一个 CloudFormation 脚本,该脚本设置 Cognito 用户池并将其配置为使用自定义电子邮件在注册过程中向用户发送他们的验证代码(即来自:noreply@mydomain.com)。
执行我的 AWS CloudFormation 脚本时出现此错误:
"ResourceStatusReason": "Cognito is not allowed to use your email identity (Service: AWSCognitoIdentityProvider; Status Code: 400; Error Code: InvalidEmailRoleAccessPolicyException;
Run Code Online (Sandbox Code Playgroud)
我附上了 Cognito 使用我的 SES 电子邮件身份的政策,例如 noreply@mydomain.com。在运行 CloudFormation 脚本之前,我已在 SES 中手动设置并验证了此电子邮件身份。
这是我的 CloudFormation 策略配置,允许 Cognito 代表我发送电子邮件,例如来自 noreply@mydomain.com:
CognitoSESPolicy:
Type: AWS::IAM::ManagedPolicy
Description: "Allow Cognito the send email on behalf of email identity (e.g. noreply@example.org)"
Properties:
PolicyDocument:
Version: 2012-10-17
Statement:
- Sid: "ucstmnt0001"
Effect: "Allow"
Action:
- "ses:SendEmail"
- "ses:SendRawEmail"
Resource: !FindInMap [ environment, !Ref "Environment", …Run Code Online (Sandbox Code Playgroud) amazon-web-services aws-cloudformation amazon-cognito aws-userpools