Create CPU high utilization alert using cloudwatch
Go to SQS then create queue
Type Standard, Name Myqueu
Rest of the settings default; Create queue
Now queue is created.
Then go to SNS under Topics under create topic. type standard,name mytopic
Type standard
NameMytopic
create topic.
go to create subcription in SNS
Topic ARN MYtopic
Protocl Email
Endpoint mail id
Create subscription
go to IAM
Create role
Trusted type AWS service
use case SNS; Next
Next
Add permission AmazonSNSRole; Next
Next
give role name SNSRole
create Role
Role created
goto SNS then create subscription
topicARN choose Mytopic
Protocol Amazon SQS
Endpoint Myqueue
create subscription
goto SQS then SNS subscription then choose subscribe to amazon sns topic
Subscription Amazon SNS topic
Amazon SNS topic select Mytopic
Save
Now SQS subscription confirmed
Pending confirmation in email
Go to email; See the mail
Open mail
Confirm subscription
Now see both subscription confirmed.
goto cloudwatch and choose all metrics
Choose Metrics then All Metrics
Metrics give ec2 instance id
Search for Ec2
Choose Per-Instance Metrics
Choose CPU utilization metric
Create Alarm in cloudWatch
Select Metric
Select ec2
Choose Pre-Instance Metrics
Choose CPU
Select metric
Default
Condition Greater/Equal than 0
Next
Notification In alarm; Select an existing SNS topic; Send a notification to Mytopic
Next
Alarm name CPU High Utilization Alert
Create alarm
alarm created in cloudwatch
Choose alarm; Edit
Given instance id
Next
Next
Next
Update alarm
Now see the alarm state; In alarm
alert message send email
see the message in SQS
now working fine..
Subscribe to my newsletter
Read articles from Sundar blog directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by