Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeCommit Notification does not send event to SNS

I set up Notification in CodeCommit on all events. The rule target SNS topic has a policy that allows principal *. However when I created a pull request. There is no event went through my SNS topic. I have a email subscription to the topic.

What have I missed and what is the possible causes?

like image 853
Shawn Avatar asked Oct 25 '25 03:10

Shawn


1 Answers

I was having the same problem.

The solution is to give permission in SNS to receive notifications from CodeCommit. To do so you need to edit the SNS "Access policy" and add the following rule:

{
      "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"
    }

Just make sure to edit the Resource property first.

Source, full explanation and example here: https://docs.aws.amazon.com/codestar-notifications/latest/userguide/notification-target-create.html

like image 158
Diego Jancic Avatar answered Oct 26 '25 16:10

Diego Jancic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!