Cloudwatch Metric query to include both Memory and CPU utilization

0

Hi, We have a CloudWatch custom alarm based on the average memory usage of and autoscaling group containing 2 EC2 instances, with the query being

SELECT AVG(mem_used_percent) FROM SCHEMA(CWAgent, AutoScalingGroupName,ImageId,InstanceId,InstanceType) WHERE AutoScalingGroupName = 'asg_name'

In this query, if usage surpasses 70%, autoscaling is automatically triggered and an additional EC2 instance is added.

Is it possible for me to add the average CPU_utilization >= 70% to this query as well? I tried using the 'UNION' operator, but unfortunately it does not work. Please help.

Note: Autoscaling group name has been changed to 'asg_name' to protect confidentiality.

asked 7 months ago647 views
2 Answers
0

Hi, you cannot mix two different metrics, UNION or apply metric maths on top of a Metrics Insights query. An alternative would be to create 2 distinct alarms, one on the CPU, one on the Mem, and join them using a composite alarm. The drawback is that there is no direct integration between the composite and autoscaling actions, so it may not be as easy to control scale up/down from there as from a metric alarm.

Otherwise as suggested by rePost-User-0046670 you could try to come up with a math expression to define your condition.

profile pictureAWS
Jsc
answered 7 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions