

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 支援 Elastic Beanstalk 環境的 Spot 執行個體
<a name="environments-cfg-autoscaling-spot"></a>

本主題說明可用於管理 Elastic Beanstalk 環境中 Spot 執行個體容量和負載平衡的組態選項。它也提供您可以用來設定這些選項的方法的詳細資訊和範例。您可以使用 [Elastic Beanstalk 主控台](environments-cfg-autoscaling-configuration-approaches.md#environments-cfg-autoscaling-console)、[命名空間組態選項](environments-cfg-autoscaling-configuration-approaches.md#environments-cfg-autoscaling-namespace)[AWS CLI](environments-cfg-autoscaling-configuration-approaches.md#environments-cfg-autoscaling-aws-cli)、 或 [EB CLI ](environments-cfg-autoscaling-configuration-approaches.md#environments-cfg-autoscaling-ebcli)來管理組態選項。

**使用容量重新平衡將 Spot 執行個體中斷降至最低**  
為了協助將 Spot 執行個體中斷對應用程式的影響降至最低，您可以啟用 Amazon EC2 Auto Scaling 隨附的容量重新平衡選項。

**重要**  
Spot 執行個體的需求可能會隨時產生極大的變化，而取決於有多少可用的未使用 Amazon EC2 執行個體，Spot 執行個體的可用性也可能會有顯著的變化。Spot 執行個體隨時都有可能中斷。

當您啟用容量重新平衡時，EC2 會在中斷之前自動嘗試取代 Auto Scaling 群組中的 Spot 執行個體。使用 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 使用者指南*》中的[容量重新平衡](https://docs.aws.amazon.com/autoscaling/ec2/userguide/capacity-rebalance.html)和《*Amazon EC2 使用者指南*》中的 [Spot 執行個體中斷](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-interruptions.html)。

**較舊的執行個體類型和 Spot 執行個體支援**  
有些較舊 AWS 的帳戶可能會為 Elastic Beanstalk 提供不支援 Spot 執行個體的預設執行個體類型。如果您啟用 Spot 執行個體請求並看到錯誤 您指定的執行個體類型都不支援 Spot，請使用支援 Spot 執行個體的執行個體類型更新您的組態。如要選擇 Spot 執行個體類型，請使用 [Spot Instance Advisor](https://aws.amazon.com/ec2/spot/instance-advisor/)。

**Topics**
+ [為您的環境啟用 Spot 執行個體](environments-cfg-autoscaling-enable-spot.md)
+ [Spot 執行個體配置策略](environments-cfg-autoscaling-spot-allocation-strategy.md)
+ [管理隨需執行個體和 Spot 執行個體](environments-cfg-autoscaling-spot-and-demand.md)
+ [Elastic Beanstalk 環境的容量組態](environments-cfg-autoscaling-configuration-approaches.md)