【问题标题】:Email arn does not belong to your account SES Cloudformation电子邮件 arn 不属于您的帐户 SES Cloudformation
【发布时间】:2018-07-05 05:22:34
【问题描述】:

我正在尝试向用户确认我发送了一封确认电子邮件。 Cogntio 需要我使用 SES 设置的电子邮件的 arn。下面是我的模板。

当我使用无服务器部署时,我得到:

An error occurred: UserPool - Email arn does not belong to your account. (Service: AWSCognitoIdentityProvider; Status Code: 400; Error Code: NotAuthorizedException; Request ID: a4ce4fc2-020b-11e8-bc29-7ff8569f2cc7).

我做错了什么?

  Resources:


    SESRole:
      Type: "AWS::IAM::Role"
      Properties:
        AssumeRolePolicyDocument:
          Version: "2008-10-17"
          Statement:
            - Effect: "Allow"
              Principal:
                Service:
                  - "cognito-idp.amazonaws.com"
              Action:
                - "sts:AssumeRole"
        Policies:
          - PolicyName: "CognitoSESPolicy"
            PolicyDocument:
              Version: "2008-10-17"
              Statement:
                - Effect: "Allow"
                  Sid: stmtXXXXXXX
                  Action:
                    - "ses:SendEmail"
                    - "ses:SendRawEmail"
                  Resource: "arn:aws:ses:eu-west-1:XXXXX:identity/XXXXXXX"

    # Creates a user pool
    UserPool:
      Type: "AWS::Cognito::UserPool"
      Properties:
        UserPoolName: ${self:service}-user-pool
        EmailConfiguration:
          ReplyToEmailAddress: XXXXX
          SourceArn:
            Fn::GetAtt: [SESRole, Arn]
        EmailVerificationSubject: "verification code"
        EmailVerificationMessage: "Please click the link below to verify your email address. {####} "
        Schema:
          - Name: name
            AttributeDataType: String

【问题讨论】:

  • arn:aws:ses:eu-west-1:XXXXX:identity/XXXXXXX 是在同一个 AWS 账户上创建的吗?
  • 应该是,我只有一个 Aws 帐户,虽然我在其中创建了一个用户,但我在控制台和 cli 上使用的是 root 帐户
  • 哦,等等,我为 cli 创建了一个用户...我正在使用 root 帐户登录控制台来设置 SES。这是我的问题吗?
  • 登录到我的具有完全管理员权限的用户帐户,我可以看到我在 SES 中创建的所有内容,因此我在这两个帐户中都有足够的权限

标签: amazon-web-services amazon-cloudformation amazon-cognito amazon-ses serverless-framework


【解决方案1】:

在 AWS SES 主页中单击已验证的电子邮件,然后单击身份策略。检查那里 Cognito-SES-Policy 是否存在。如果它不存在然后单击 CreatePolicy -> 自定义策略并粘贴此代码:-

{
    "Version": "2008-10-17",
    "Statement": [
        {
             "Sid": "stmnt6857725459985",
             "Effect": "Allow",
             "Principal": {
                "Service": "cognito-idp.amazonaws.com"
             },
             "Action": [
                 "ses:SendEmail",
                 "ses:SendRawEmail"
             ],
             "Resource": "arn:aws:ses:Region:<ACCOUNT-ID>:identity/sample@example.com"
         }
     ]
 }

2.在 Cloud Formation 模板中为 EmailConfiguration 下的 SourceARN 使用 IdentityARN。

EmailConfiguration:
          ReplyToEmailAddress: XXXXX
          SourceArn:
            "arn:aws:ses:Region:<ACCOUNT-ID>:identity/sample@example.com"

【讨论】:

    猜你喜欢
    • 2019-08-22
    • 2021-08-16
    • 2019-12-04
    • 1970-01-01
    • 2020-07-19
    • 2015-11-01
    • 2012-04-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多