Auto Scaling your Elastic Beanstalk environment instances - AWS Elastic Beanstalk

Auto Scaling your Elastic Beanstalk environment instances

This topic describes how you can customize the Auto Scaling features to manage your Elastic Beanstalk environment’s workload. You can configure Auto Scaling for your environment using the Elastic Beanstalk console, namespace configuration options, the AWS CLI, or the EB CLI.

Load-balanced or single instance environments

Your AWS Elastic Beanstalk environment includes an Auto Scaling group that manages the Amazon EC2 instances in your environment. In a single-instance environment, the Auto Scaling group ensures that there is always one instance running. In a load-balanced environment, you configure the group with a range of instances to run, and Auto Scaling adds or removes instances as needed, based on load.

EC2 Instance configuration

The Auto Scaling group also applies your configuration choices to provision and manage the EC2 instances in your environment. You can modify the EC2 configuration to change the instance type, key pair, Amazon Elastic Block Store (Amazon EBS) storage, and other settings that can only be configured when you launch an instance.

On-Demand and Spot Instances

As an option, Elastic Beanstalk can include Spot Instances in your environment and manage them in combination with On-Demand instances. You can configure Amazon EC2 Auto Scaling to monitor and automatically respond to changes that affect the availability of your Spot Instances by enabling Capacity Rebalancing. You can also configure the Spot allocation strategy that the Auto Scaling service uses to provision Spot Instances to your environment.

Required permissions when enabling Spot Instances

Enabling Spot Instance requests requires using Amazon EC2 launch templates. When you configure this feature during environment creation or updates, Elastic Beanstalk attempts to configure your environment to use Amazon EC2 launch templates (if the environment isn't using them already). In this case, if your user policy lacks the necessary permissions, environment creation or updates might fail. Therefore, we recommend that you use our managed user policy or add the required permissions to your custom policies. For details about the required permissions, see Required permissions for launch templates.

Auto Scaling triggers

The Auto Scaling group 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 MiB or lower than 2 MiB over a period of five minutes. To use Auto Scaling effectively, configure triggers that are appropriate for your application, instance type, and service requirements. You can scale based on several statistics including latency, disk I/O, CPU utilization, and request count.

Schedule Auto Scaling actions

To optimize your environment's use of Amazon EC2 instances through predictable periods of peak traffic, configure your Auto Scaling group to change its instance count on a schedule. You can schedule changes to your group's configuration that recur daily or weekly, or schedule one-time changes to prepare for marketing events that will drive a lot of traffic to your site.

Auto Scaling health check

Auto Scaling monitors the health of each Amazon EC2 instance that it launches. If any instance terminates unexpectedly, Auto Scaling detects the termination and launches a replacement instance. To configure the group to use the load balancer's health check mechanism, see Auto Scaling health check setting for your Elastic Beanstalk environment.