I am publishing a custom cloudwatch metric using the nodejs aws sdk. The metric successfully shows up in the cloudwatch admin console. However, it does not show up among the scaling trigger options for my elastic beanstalk environment. Is it possible to configure elastic beanstalk to use the custom metric as a scaling trigger using the aws
cli, .ebextensions
, or something else?
The Auto Scaling group in your Elastic Beanstalk environment uses two Amazon CloudWatch alarms to trigger scaling operations. The default triggers scale when the average outbound network traffic from each instance is higher than 6 MB or lower than 2 MB over a period of five minutes.
In the navigation pane, choose Alarms, All alarms and then choose Create alarm. Choose Select metric. On the All metrics tab, choose EC2, By Auto Scaling Group, and enter the Auto Scaling group's name in the search field. Then, select CPUUtilization and choose Select metric.
Deploy your application and view your metrics Deploy your updated Elastic Beanstalk application. 2. To see your memory utilization metrics, open the CloudWatch console, and then choose Metrics in the navigation pane. You can see your metrics in the custom namespace labeled CWAgent.
The Auto Scaling action isn't enabled for the CloudWatch alarm, which prevents the scaling policy from being invoked. The scaling policy in the Auto Scaling group is disabled. A disabled policy prevents the group from being evaluated.
Currently you cannot add custom metrics for autoscaling in beanstalk from beanstalk dashboard.
You have to implement a workaround for this using the Auto Scaling command line tools and the CloudWatch command line.
Here is one good case study you can refer to which implemented a custom metric to autoscale in a beanstalk environment.
http://blog.cbeer.info/2016/autoscaling-elasticbeanstalk-workers-sqs-length/
I ended up creating a alarm through the cloudwatch console, and having the alarm trigger autoscaling events for the correct autoscaling group.
More info: https://aws.amazon.com/premiumsupport/knowledge-center/auto-scaling-cloudwatch/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With