CloudWatch Alarm behaving weird for stopping EC2

0

Hi there, hope all of you are fine. I am trying to configure Alarm for stopping EC2 when it is idle. I have tried CPU threshold with average, sum, with different time periods, but none is working. As you can see in this image, Alarm is in  INALARM state for more than an hour, but EC2 is not stopped.

Maybe, it is continuing the previous state, before alarm was updated, but this should not be the behavior, it should check if the Instance is stopped or not..

Kindly help me with this, thanks.

질문됨 2년 전471회 조회
1개 답변
0

Assuming this is the use case: To stop the EC2 instance when the CPUUtilization is less than X%.

Depending on whether or not detailed monitoring is enabled for the EC2 instance, the period for your alarm must be selected accordingly. Enable or turn off detailed monitoring for your instances. In case of detailed monitoring the metrics is populated with datapoints every minute.

  • Without detailed monitoring enabled, selecting a period of 5-min 'or' above should give the alarm enough datapoints for evaluation i.e. regardless of "Datapoints to alarm" value - the alarm will not have missing datapoints as long as the metric is populated every 5 minutes.
  • Regarding statistics you choose for the alarm - I'd recommend to use 'Average' but any other statistic is valid/appropriate for this metric.
  • If the alarm is continuing to maintain its state when there is missing data check for the configuration of Missing data treatment, whether it is set to ignore. Change it to either breaching, notBreaching or missing as per your use case. Read more about missing data here.

If you are new to CloudWatch alarms, see if this documentation helps in creating an alarm to stop EC2 instance using CPUUtilization metric, read this: Add stop actions to CloudWatch alarms.

profile pictureAWS
지원 엔지니어
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠