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

2 minute read
0

My AWS Elastic Beanstalk environment doesn’t scale the way that I expect it to.

Resolution

Prerequisites:

  • Your Amazon Elastic Compute Cloud (Amazon EC2) instances have sufficient capacity to scale in your AWS Region. This capacity is based on the maximum number of instances that you define in your AWS Auto Scaling group configuration.
  • You have a cooldown period that's based on the installation and configuration requirements of your application.
  • You use default Amazon CloudWatch metrics or Locust to do a load test and identify the best metric to initiate scaling.

To configure your scaling triggers, use either the Elastic Beanstalk 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 your trigger options, 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

Use .ebextensions in option settings to modify your scaling configurations. To access the configuration file that's used to configure your scaling triggers, see autoscaling-triggers-customize.config on the GitHub website.

The following example configuration file modifies the scaling triggers that are based on CPU utilization. If CPU utilization across all instances is more than 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 less than 20 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'

The following example shows the structure of the .ebextensions directory and autoscaling-triggers-customize.config file in the application zip file:

~/my-app/
|-- .ebextensions/
|   |-- autoscaling-triggers-customize.config
|   `-- other.config
|-- other application files

Related information

Auto Scaling triggers

AWS OFFICIAL
AWS OFFICIALUpdated 10 days ago
2 Comments

Does not help in the case of missing or damaged cloudwatch components or if scaling is obviously crippled. Needs to be an all encompassing "repair" button in the portal. Also a verbose log would be useful. Good to see negative increments for effective decrements though.

replied 7 months ago

Thank you for your comment. We'll review and update the Knowledge Center article as needed.

profile pictureAWS
MODERATOR
replied 7 months ago