Bobcares

Notifications for scheduled events using CloudWatch Events – How to set up

by | Jul 26, 2021

Wondering how to set up notifications for scheduled events using CloudWatch Events? We can help you!

Here at Bobcares, we get requests from our customers to do this set up as a part of our Server Management Services.

Today let’s see how our Support Engineers do this for our customers with EC2 instances.

How to set Notification for scheduled events using CloudWatch Events

We will create a CloudWatch Events rule to trigger on a scheduled event for the EC2 instance. And configure Amazon Simple Notification Service (Amazon SNS) notifications for events that match our event pattern.

Steps to follow:

To Create a CloudWatch Events rule that triggers on an event using the CloudWatch console we can do the following:

1.    Firstly, for Event Pattern, we can select Build Event pattern to match events by service.

2.    Then for Service Name, we can select Health.

3.    After that, for Event Type, we can select Specific Health events.

4.    Now go to Specific service(s), and select EC2.

5.    Then click on Specific event type category(s), and select scheduledChange.

The above settings create the following event pattern:

Notification for scheduled events using CloudWatch Events

Selecting the SNS target:

1.    Firstly, select Add Target.

2.    Then provide SNS topic.

3.    We can give a topic that we wish to use for notifications.

4.    After that go to Configure details.

5.    Here we have to configure additional settings as necessary, such as further event processing with Lambda.

6.    Finally click on Create Rule.

The following example shows what a scheduled event looks like when it’s pushed to CloudWatch Events.

{
  "version": "0",
  "id": "7fb65329-1628-4cf3-a740-95fg457h1402",
  "detail-type": "AWS Health Event",
  "source": "aws.health",
  "account": "123456789101",
  "time": "2016-06-05T06:27:57Z",
  "region": "us-east-1",
  "resources": ["i-12345678"],
  "detail": {
    "eventArn": "arn:aws:health:region::event/id",
    "service": "EC2",
    "eventTypeCode": "AWS_EC2_DEDICATED_HOST_NETWORK_MAINTENANCE_SCHEDULED",
    "eventTypeCategory": "scheduledChange",
    "startTime": "Sat, 05 Jun 2016 15:10:09 GMT",
    "eventDescription": [{
      "language": "en_US",
      "latestDescription": "A description of the event will be provided here"
    }],
    "affectedEntities": [{
      "entityValue": "i-12345678",
      "tags": {
        "stage": "prod",
        "app": "my-app"
      }
    }]
  }
}

[Need assistance? We can help you]

Conclusion

To conclude, we saw the steps that our Support Techs follow to set notifications for scheduled events using CloudWatch Events.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.