0

I want to receive notifications from AWS Eventbridge when there's a scheduled event for my Amazon Elastic Compute Cloud (Amazon EC2) instance.

enter image description here

I created an Eventbridge rule and set the target to an already working SNS topic. The SNS topic is subscribed to a working Lambda function that is used for other "Cloudwatch to slack" alarms already. The eventbridge setting is as follows:

{
  "source": ["aws.health"],
  "detail-type": ["AWS Health Event"],
  "detail": {
    "service": ["EC2"],
    "eventTypeCategory": ["scheduledChange"]
  }
}

enter image description here

enter image description here

I already got an EC2 scheduled maintenance(reboot) notification as e-mail from AWS, but this eventbridge I created did not trigger for that and did not send any notification to the slack channel.

I am unsure now if I am missing something in the setting. I am setting it for the first time and no way to simply test it with fake input. It is supposed to work even if there is a single schedule event that appears in the top bell icon(as shown in the screenshot above), correct?

vjwilson
  • 754
  • 2
  • 14
  • 30

2 Answers2

2

In order to find out the root cause of this issue, I suggest to take a look a the CloudWatch usage metrics for SNS. SNS reports the following metrics which might be useful for you: NumberOfMessagesPublished, NumberOfNotificationsDelivered NumberOfNotificationsFailed. If you find these metrics reported an they have a value different than 0, this means that SNS receives events from Event Bridge and the problem is somewhere else.

If you are using a Lambda to send messages to Slack, you should take a look at the logs in CloudWatch to see if the Lambda did execute successfully. You might want to check out the setup for Lambda recommended by AWS: (link)

For further debugging you may want to check out test-event-pattern CLI command.

It is supposed to work even if there is a single schedule event that appears in the top bell icon(as shown in the screenshot above), correct?

Yeah, it supposed to work even if there already is an event.

Ervin Szilagyi
  • 14,274
  • 2
  • 25
  • 40
  • Thank you Ervin for some good input here. Can you check the screenshots? http://c2n.me/4e2fqht http://c2n.me/4e2fqrR Could you help me further?. It shows published and delivered as value 1. That means working, correct?. But I don't see anything on my slack channel. – vjwilson Nov 18 '21 at 08:49
  • I see that you have a maintenance event from CloudWatch, although I see no values for SNS successful publishing or failures. Please check if you have a Lambda or something subscribed to the SNS topic. – Ervin Szilagyi Nov 18 '21 at 16:29
  • Hmm, the SNS topic is subscribed to the lambda function already and they are being used already for some CloudWatch alarms to slack. Do you think if any IAM role needs to specify between AWS Eventbridge and SNS or between AWS Eventbridge and Lambda?. – vjwilson Nov 20 '21 at 14:37
0

I'm having a similar issue with eventbridge rule being built with cloudformation. I had to manually go into the eventbridge rule via the AWS console and go to the trigger and select the SNS topic again. It now works. It took me a while to figure out. Can you confirm that the fix did that for you as I'm not sure how to fix this...