

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# Elastic Beanstalk 环境的竞价型实例支持
<a name="environments-cfg-autoscaling-spot"></a>

本主题介绍可用于管理您 Elastic Beanstalk 环境中竞价型实例的容量和负载均衡的配置选项。其还提供了可用于配置这些选项的方法的详细信息和示例。您可以使用 [Elastic Beanstalk 控制台](environments-cfg-autoscaling-configuration-approaches.md#environments-cfg-autoscaling-console)、[命名空间配置选项](environments-cfg-autoscaling-configuration-approaches.md#environments-cfg-autoscaling-namespace)、[Amazon CLI](environments-cfg-autoscaling-configuration-approaches.md#environments-cfg-autoscaling-aws-cli) 或 [EB CLI](environments-cfg-autoscaling-configuration-approaches.md#environments-cfg-autoscaling-ebcli) 来管理配置选项。

**通过容量重新平衡最大限度地减少竞价型实例中断**  
为了帮助最大限度地减少竞价型实例中断对应用程序的影响，您可以启用 Amazon EC2 Auto Scaling 附带的“容量重新平衡”选项。

**重要**  
对 Spot 实例的需求在不同时间可能有显著的差异，Spot 实例的可用性也会因为未使用 Amazon EC2 实例的可用数量而差别巨大。Spot 实例可能会中断。

启用容量重新平衡后，EC2 会在中断前自动尝试替换自动扩缩组中的竞价型实例。要启用此功能，请使用 Elastic Beanstalk 控制台以[配置 Auto Scaling 组](environments-cfg-autoscaling-configuration-approaches.md#environments-cfg-autoscaling-console)。或者，您可以在 [aws:autoscaling:asg](command-options-general.md#command-options-general-autoscalingasg) 命名空间中将 Elastic Beanstalk `EnableCapacityRebalancing` [配置选项](environments-cfg-autoscaling-configuration-approaches.md#environments-cfg-autoscaling-namespace)设置为 `true`。

有关更多信息，请参阅《*Amazon EC2 Auto Scaling 用户指南*》中的 [Capacity Rebalancing](https://docs.amazonaws.cn/autoscaling/ec2/userguide/capacity-rebalance.html) 和《*Amazon EC2 用户指南*》中的[竞价型实例中断](https://docs.amazonaws.cn/AWSEC2/latest/UserGuide/spot-interruptions.html)。

**较旧的实例类型和竞价型实例支持**  
一些较旧的 Amazon 账户可能会为 Elastic Beanstalk 提供不支持竞价型实例的默认实例类型。如果启用竞价型实例请求，并且系统显示您指定的所有实例类型均不支持竞价型实例错误，请以支持竞价型实例的实例类型更新配置。要选择 Spot 实例类型，请使用 [Spot Instance Advisor](https://www.amazonaws.cn/ec2/spot/instance-advisor/)。

**Topics**
+ [为环境启用竞价型实例](environments-cfg-autoscaling-enable-spot.md)
+ [竞价型实例的分配策略](environments-cfg-autoscaling-spot-allocation-strategy.md)
+ [管理按需型实例和竞价型实例](environments-cfg-autoscaling-spot-and-demand.md)
+ [Elastic Beanstalk 环境的容量配置](environments-cfg-autoscaling-configuration-approaches.md)