We can create a CloudWatch event as follows:
- Go to the CloudWatch service in the console.
- If we are using CloudWatch events for the first time, we should see a Getting started page. Click on Get started. We should be taken to the Create rule page.
We can also reach the Create rule page as follows: click on Rules from the left sidebar and click on Create rule on the Rules page.
- Under the Event Source section, do the following:
- Select Event Pattern.
- Set Service Name to EC2.
- Set Event Type to EC2 Instance State-change Notification.
- Select Any state and Any instance:
- Under Targets, do the following:
- Click on Add target ...