How do I troubleshoot issues with scaling triggers in Elastic Beanstalk?

Last updated: 2019-10-08

My AWS Elastic Beanstalk environment isn't scaling the way that I expected. How can I resolve this issue?

Short Description

The Auto Scaling group in your Elastic Beanstalk environment uses two Amazon CloudWatch alarms to trigger scaling operations. Default Auto Scaling triggers are configured to scale when the average outbound network traffic (NetworkOut) from each instance is higher than 6 MB or lower than 2 MB over a period of five minutes.

To use Amazon EC2 Auto Scaling effectively, you must configure scaling triggers that are appropriate for your application, instance type, and service requirements.

Note: You can scale your environment based on several statistics, including latency, disk I/O, CPU utilization, and request count. In advanced scenarios, consider using .ebextensions based on custom metrics such as memory.

Before you start the steps in the Resolution section, confirm the following:

  • You have sufficient capacity for your Amazon Elastic Compute Cloud (Amazon EC2) instances to scale in your AWS Region based on the maximum number of instances that can be contained in the Auto Scaling group defined in your environment configuration.
  • You have a cooldown period set, if necessary, based on the installation and configuration requirements of your application.
  • You have identified the best metric for your environment to trigger by load testing with default metrics from CloudWatch or more advanced load generating and testing with Locust.

Resolution

To configure your scaling triggers, complete the steps using either the AWS Management Console or option settings:

Configure scaling triggers in the Elastic Beanstalk console

1.    Open the Elastic Beanstalk console, and then choose your environment.

2.    In the navigation pane, choose Configuration.

3.    For the Capacity category, choose Modify.

4.    In the Scaling Triggers section, choose the triggering options based on your needs, and then choose Apply.

Note: Elastic Beanstalk provides configuration options for Auto Scaling settings in the aws:autoscaling:trigger namespace. Settings in this namespace are organized by the resource that they apply to.

Configure scaling triggers with option settings

Modify your scaling configurations using .ebextensions in option settings.

The following example modifies the scaling triggers to be based on CPU utilization. If CPU utilization across all instances is above 80 percent over three consecutive two-minute periods, then one instance is added to the Auto Scaling group. If CPU utilization across all instances is below two percent for the same period, then one instance is removed from the Auto Scaling group.

option_settings:
  aws:autoscaling:trigger:
    MeasureName: CPUUtilization
    Statistic: Average
    Unit: Percent
    Period: '2'
    EvaluationPeriods: '3'
    UpperThreshold: '80'
    UpperBreachScaleIncrement: '1'
    LowerThreshold: '20'
    LowerBreachScaleIncrement: '-1'

Did this article help you?

Anything we could improve?


Need more help?