Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS cloudwatch custom metric as elastic beanstalk autoscale trigger

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?

like image 894
Ben Southgate Avatar asked Jul 29 '16 19:07

Ben Southgate


People also ask

What triggers Auto Scaling?

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.

How do I trigger Auto Scaling in AWS?

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.

How can I monitor CloudWatch memory usage metrics for Elastic Beanstalk?

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.

Can CloudWatch trigger Auto Scaling?

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.


2 Answers

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/

like image 123
error2007s Avatar answered Nov 09 '22 17:11

error2007s


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/

like image 2
Ben Southgate Avatar answered Nov 09 '22 18:11

Ben Southgate