CodeCommit 通知不向 SNS 发送事件

Sha*_*awn 2 amazon-web-services amazon-sns aws-codecommit

我在 CodeCommit 中针对所有事件设置了通知。规则目标 SNS 主题具有允许主体 *. 但是,当我创建拉取请求时。没有任何事件通过我的 SNS 主题。我有该主题的电子邮件订阅。

我错过了什么,可能的原因是什么?

Die*_*cic 5

我遇到了同样的问题。

解决方案是在 SNS 中授予接收来自 CodeCommit 通知的权限。为此,您需要编辑 SNS“访问策略”并添加以下规则:

{
      "Sid": "AWSCodeStarNotifications_publish",
      "Effect": "Allow",
      "Principal": {
        "Service": [
          "codestar-notifications.amazonaws.com"
        ]
      },
      "Action": "SNS:Publish",
      "Resource": "arn:aws:sns:us-east-1:123456789012:codestar-notifications-MyTopicForNotificationRules"
    }
Run Code Online (Sandbox Code Playgroud)

只需确保首先编辑Resource属性。

来源,完整解释和示例:https : //docs.aws.amazon.com/codestar-notifications/latest/userguide/notification-target-create.html