Here is how you create a CloudWatch alarm to monitor CPU Credit Balances less than a certain amount:

aws cloudwatch put-metric-alarm --alarm-name YOUR NAME HERE--alarm-description "Alarm when CPU Credits is below 200" --metric-name CPUCreditBalance --namespace AWS/EC2 --statistic Average --period 300 --threshold 200 --comparison-operator LessThanThreshold --dimensions Name=InstanceId,Value=INSTANCEIDHERE --evaluation-periods 2 --alarm-actions ARN:YOURSNSTOPIC

CloudFormation Template:
https://github.com/avansledright/CloudFormation-CPU-CREDIT-BALANCE

Leave a comment

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