100 Days of AWS — Day 10— AWS CloudWatch Events to monitor resource changes
To view the complete course, please enroll it using the below link(it’s free)
https://www.101daysofdevops.com/courses/100-days-of-aws/
Welcome to Day 10 of 100 Days of AWS. The topic for today is AWS CloudWatch Events to monitor resource changes.
An AWS CloudEvents is used to stream near real-time stream of system events which describe the change in AWS resources(for example EC2 instance goes to stop state, EBS Volume changes like create or delete volume) and takes corrective action as necessary. It supports AWS resources like EC2, Lambda, Kinesis, Step Functions and CodePipeline etc.
- In order to configure it, go to CloudWatch console https://us-east-1.console.aws.amazon.com/cloudwatch/home?region=us-east-1#rules: and click on Back to CloudWatch Events.
NOTE: Amazon EventBridge builds upon and extends CloudWatch Events. It uses the same service API and endpoint, and the same underlying service infrastructure. For this demo I am still sticking with old technology CloudWatch Events.
- In the next screen click on Create rule
- Under Event Pattern, select Service Name as EC2, Event Type as EC2 Instance State-change Notification and under Specific state(s) select stopped. The other Specific state(s) of an instance is (pending, running, shutting-down, stopping, terminated). Then you have an option to select Any instance or Specific Instance Id(s). On the right handside select the SNS topic we have create on Day9 or you can create a new SNS topic. At the bottom of the screen click on Configure details.
- In the next screen give your rule some name and click on Create rule.
- Go to the EC2 console https://us-east-1.console.aws.amazon.com/ec 2 and stop your instance.
- This will trigger an alert and you will receive an email
- Similar notification you can setup for EBS volumes like attachVolume, createVolume, deleteVolume etc.
- Bunch of other services supported by CloudWatch events