我在 CodeCommit 中针对所有事件设置了通知。规则目标 SNS 主题具有允许主体 * 的策略。但是,当我创建拉取请求时。没有事件通过我的 SNS 主题。我有该主题的电子邮件订阅。
我错过了什么,可能的原因是什么?
最佳答案
我遇到了同样的问题。
解决方案是在 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"
}
只需确保先编辑Resource 属性即可。
来源、完整解释和示例在这里:https://docs.aws.amazon.com/codestar-notifications/latest/userguide/notification-target-create.html
关于amazon-web-services - CodeCommit 通知不向 SNS 发送事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59864569/