I'm trying to figure out how to autoscale a group of EC2 instances based off of a custom metric (percent of memory utilization).
In the AMI snapshot that I use for my Autoscaling Group, I have a script stored such that upon every boot/reboot, the EC2 instance will configure the CloudWatch Agent to monitor this metric.
A lot of guides suggest that I need to create a Cloudwatch Alarm based off of this metric in order to target track it in ASG, but when I go to create the alarm, I notice that the alarm is only for one specific EC2 instance, not the entire group (and on top of that, I assume that when ASG scales out and adds more EC2 instances, there will be no Cloudwatch alarm based on these newly spawned EC2s).
I want my ASG setup to be such that, when any EC2 in the group reaches 85% memory utilization, ASG will know to spin up a new EC2 instance to add to the capacity. Can this be done? Is the way that I'm attempting to approach it so far incorrect?