/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.ec2.model; import java.io.Serializable; import javax.annotation.Generated; /** *
* Describes the configuration of Spot Instances in an EC2 Fleet request. *
* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class SpotOptionsRequest implements Serializable, Cloneable { /** ** The strategy that determines how to allocate the target Spot Instance capacity across the Spot Instance pools * specified by the EC2 Fleet launch configuration. For more information, see Allocation * strategies for Spot Instances in the Amazon EC2 User Guide. *
** EC2 Fleet identifies the pools with the highest capacity availability for the number of instances that are * launching. This means that we will request Spot Instances from the pools that we believe have the lowest chance * of interruption in the near term. EC2 Fleet then requests Spot Instances from the lowest priced of these pools. *
*
* EC2 Fleet identifies the pools with the highest capacity availability for the number of instances that are
* launching. This means that we will request Spot Instances from the pools that we believe have the lowest chance
* of interruption in the near term. To give certain instance types a higher chance of launching first, use
* capacity-optimized-prioritized
. Set a priority for each instance type by using the
* Priority
parameter for LaunchTemplateOverrides
. You can assign the same priority to
* different LaunchTemplateOverrides
. EC2 implements the priorities on a best-effort basis, but
* optimizes for capacity first. capacity-optimized-prioritized
is supported only if your EC2 Fleet
* uses a launch template. Note that if the On-Demand AllocationStrategy
is set to
* prioritized
, the same priority is applied when fulfilling On-Demand capacity.
*
* EC2 Fleet requests instances from all of the Spot Instance pools that you specify. *
** EC2 Fleet requests instances from the lowest priced Spot Instance pool that has available capacity. If the lowest * priced pool doesn't have available capacity, the Spot Instances come from the next lowest priced pool that has * available capacity. If a pool runs out of capacity before fulfilling your desired capacity, EC2 Fleet will * continue to fulfill your request by drawing from the next lowest priced pool. To ensure that your desired * capacity is met, you might receive Spot Instances from several pools. Because this strategy only considers * instance price and not capacity availability, it might lead to high interruption rates. *
*
* Default: lowest-price
*
* The strategies for managing your Spot Instances that are at an elevated risk of being interrupted. *
*/ private FleetSpotMaintenanceStrategiesRequest maintenanceStrategies; /** ** The behavior when a Spot Instance is interrupted. *
*
* Default: terminate
*
* The number of Spot pools across which to allocate your target Spot capacity. Supported only when Spot
* AllocationStrategy
is set to lowest-price
. EC2 Fleet selects the cheapest Spot pools
* and evenly allocates your target Spot capacity across the number of Spot pools that you specify.
*
* Note that EC2 Fleet attempts to draw Spot Instances from the number of pools that you specify on a best effort * basis. If a pool runs out of Spot capacity before fulfilling your target capacity, EC2 Fleet will continue to * fulfill your request by drawing from the next cheapest pool. To ensure that your target capacity is met, you * might receive Spot Instances from more than the number of pools that you specified. Similarly, if most of the * pools have no Spot capacity, you might receive your full target capacity from fewer than the number of pools that * you specified. *
*/ private Integer instancePoolsToUseCount; /** ** Indicates that the fleet uses a single instance type to launch all Spot Instances in the fleet. *
*
* Supported only for fleets of type instant
.
*
* Indicates that the fleet launches all Spot Instances into a single Availability Zone. *
*
* Supported only for fleets of type instant
.
*
* The minimum target capacity for Spot Instances in the fleet. If the minimum target capacity is not reached, the * fleet launches no instances. *
*
* Supported only for fleets of type instant
.
*
* At least one of the following must be specified: SingleAvailabilityZone
|
* SingleInstanceType
*
* The maximum amount per hour for Spot Instances that you're willing to pay. We do not recommend using this * parameter because it can lead to increased interruptions. If you do not specify this parameter, you will pay the * current Spot price. *
** If you specify a maximum price, your Spot Instances will be interrupted more frequently than if you do not * specify this parameter. *
** The strategy that determines how to allocate the target Spot Instance capacity across the Spot Instance pools * specified by the EC2 Fleet launch configuration. For more information, see Allocation * strategies for Spot Instances in the Amazon EC2 User Guide. *
** EC2 Fleet identifies the pools with the highest capacity availability for the number of instances that are * launching. This means that we will request Spot Instances from the pools that we believe have the lowest chance * of interruption in the near term. EC2 Fleet then requests Spot Instances from the lowest priced of these pools. *
*
* EC2 Fleet identifies the pools with the highest capacity availability for the number of instances that are
* launching. This means that we will request Spot Instances from the pools that we believe have the lowest chance
* of interruption in the near term. To give certain instance types a higher chance of launching first, use
* capacity-optimized-prioritized
. Set a priority for each instance type by using the
* Priority
parameter for LaunchTemplateOverrides
. You can assign the same priority to
* different LaunchTemplateOverrides
. EC2 implements the priorities on a best-effort basis, but
* optimizes for capacity first. capacity-optimized-prioritized
is supported only if your EC2 Fleet
* uses a launch template. Note that if the On-Demand AllocationStrategy
is set to
* prioritized
, the same priority is applied when fulfilling On-Demand capacity.
*
* EC2 Fleet requests instances from all of the Spot Instance pools that you specify. *
** EC2 Fleet requests instances from the lowest priced Spot Instance pool that has available capacity. If the lowest * priced pool doesn't have available capacity, the Spot Instances come from the next lowest priced pool that has * available capacity. If a pool runs out of capacity before fulfilling your desired capacity, EC2 Fleet will * continue to fulfill your request by drawing from the next lowest priced pool. To ensure that your desired * capacity is met, you might receive Spot Instances from several pools. Because this strategy only considers * instance price and not capacity availability, it might lead to high interruption rates. *
*
* Default: lowest-price
*
* EC2 Fleet identifies the pools with the highest capacity availability for the number of instances that are * launching. This means that we will request Spot Instances from the pools that we believe have the lowest * chance of interruption in the near term. EC2 Fleet then requests Spot Instances from the lowest priced of * these pools. *
*
* EC2 Fleet identifies the pools with the highest capacity availability for the number of instances that are
* launching. This means that we will request Spot Instances from the pools that we believe have the lowest
* chance of interruption in the near term. To give certain instance types a higher chance of launching
* first, use capacity-optimized-prioritized
. Set a priority for each instance type by using the
* Priority
parameter for LaunchTemplateOverrides
. You can assign the same priority
* to different LaunchTemplateOverrides
. EC2 implements the priorities on a best-effort basis,
* but optimizes for capacity first. capacity-optimized-prioritized
is supported only if your
* EC2 Fleet uses a launch template. Note that if the On-Demand AllocationStrategy
is set to
* prioritized
, the same priority is applied when fulfilling On-Demand capacity.
*
* EC2 Fleet requests instances from all of the Spot Instance pools that you specify. *
** EC2 Fleet requests instances from the lowest priced Spot Instance pool that has available capacity. If the * lowest priced pool doesn't have available capacity, the Spot Instances come from the next lowest priced * pool that has available capacity. If a pool runs out of capacity before fulfilling your desired capacity, * EC2 Fleet will continue to fulfill your request by drawing from the next lowest priced pool. To ensure * that your desired capacity is met, you might receive Spot Instances from several pools. Because this * strategy only considers instance price and not capacity availability, it might lead to high interruption * rates. *
*
* Default: lowest-price
* @see SpotAllocationStrategy
*/
public void setAllocationStrategy(String allocationStrategy) {
this.allocationStrategy = allocationStrategy;
}
/**
*
* The strategy that determines how to allocate the target Spot Instance capacity across the Spot Instance pools * specified by the EC2 Fleet launch configuration. For more information, see Allocation * strategies for Spot Instances in the Amazon EC2 User Guide. *
** EC2 Fleet identifies the pools with the highest capacity availability for the number of instances that are * launching. This means that we will request Spot Instances from the pools that we believe have the lowest chance * of interruption in the near term. EC2 Fleet then requests Spot Instances from the lowest priced of these pools. *
*
* EC2 Fleet identifies the pools with the highest capacity availability for the number of instances that are
* launching. This means that we will request Spot Instances from the pools that we believe have the lowest chance
* of interruption in the near term. To give certain instance types a higher chance of launching first, use
* capacity-optimized-prioritized
. Set a priority for each instance type by using the
* Priority
parameter for LaunchTemplateOverrides
. You can assign the same priority to
* different LaunchTemplateOverrides
. EC2 implements the priorities on a best-effort basis, but
* optimizes for capacity first. capacity-optimized-prioritized
is supported only if your EC2 Fleet
* uses a launch template. Note that if the On-Demand AllocationStrategy
is set to
* prioritized
, the same priority is applied when fulfilling On-Demand capacity.
*
* EC2 Fleet requests instances from all of the Spot Instance pools that you specify. *
** EC2 Fleet requests instances from the lowest priced Spot Instance pool that has available capacity. If the lowest * priced pool doesn't have available capacity, the Spot Instances come from the next lowest priced pool that has * available capacity. If a pool runs out of capacity before fulfilling your desired capacity, EC2 Fleet will * continue to fulfill your request by drawing from the next lowest priced pool. To ensure that your desired * capacity is met, you might receive Spot Instances from several pools. Because this strategy only considers * instance price and not capacity availability, it might lead to high interruption rates. *
*
* Default: lowest-price
*
* EC2 Fleet identifies the pools with the highest capacity availability for the number of instances that * are launching. This means that we will request Spot Instances from the pools that we believe have the * lowest chance of interruption in the near term. EC2 Fleet then requests Spot Instances from the lowest * priced of these pools. *
*
* EC2 Fleet identifies the pools with the highest capacity availability for the number of instances that
* are launching. This means that we will request Spot Instances from the pools that we believe have the
* lowest chance of interruption in the near term. To give certain instance types a higher chance of
* launching first, use capacity-optimized-prioritized
. Set a priority for each instance type
* by using the Priority
parameter for LaunchTemplateOverrides
. You can assign the
* same priority to different LaunchTemplateOverrides
. EC2 implements the priorities on a
* best-effort basis, but optimizes for capacity first. capacity-optimized-prioritized
is
* supported only if your EC2 Fleet uses a launch template. Note that if the On-Demand
* AllocationStrategy
is set to prioritized
, the same priority is applied when
* fulfilling On-Demand capacity.
*
* EC2 Fleet requests instances from all of the Spot Instance pools that you specify. *
** EC2 Fleet requests instances from the lowest priced Spot Instance pool that has available capacity. If * the lowest priced pool doesn't have available capacity, the Spot Instances come from the next lowest * priced pool that has available capacity. If a pool runs out of capacity before fulfilling your desired * capacity, EC2 Fleet will continue to fulfill your request by drawing from the next lowest priced pool. To * ensure that your desired capacity is met, you might receive Spot Instances from several pools. Because * this strategy only considers instance price and not capacity availability, it might lead to high * interruption rates. *
*
* Default: lowest-price
* @see SpotAllocationStrategy
*/
public String getAllocationStrategy() {
return this.allocationStrategy;
}
/**
*
* The strategy that determines how to allocate the target Spot Instance capacity across the Spot Instance pools * specified by the EC2 Fleet launch configuration. For more information, see Allocation * strategies for Spot Instances in the Amazon EC2 User Guide. *
** EC2 Fleet identifies the pools with the highest capacity availability for the number of instances that are * launching. This means that we will request Spot Instances from the pools that we believe have the lowest chance * of interruption in the near term. EC2 Fleet then requests Spot Instances from the lowest priced of these pools. *
*
* EC2 Fleet identifies the pools with the highest capacity availability for the number of instances that are
* launching. This means that we will request Spot Instances from the pools that we believe have the lowest chance
* of interruption in the near term. To give certain instance types a higher chance of launching first, use
* capacity-optimized-prioritized
. Set a priority for each instance type by using the
* Priority
parameter for LaunchTemplateOverrides
. You can assign the same priority to
* different LaunchTemplateOverrides
. EC2 implements the priorities on a best-effort basis, but
* optimizes for capacity first. capacity-optimized-prioritized
is supported only if your EC2 Fleet
* uses a launch template. Note that if the On-Demand AllocationStrategy
is set to
* prioritized
, the same priority is applied when fulfilling On-Demand capacity.
*
* EC2 Fleet requests instances from all of the Spot Instance pools that you specify. *
** EC2 Fleet requests instances from the lowest priced Spot Instance pool that has available capacity. If the lowest * priced pool doesn't have available capacity, the Spot Instances come from the next lowest priced pool that has * available capacity. If a pool runs out of capacity before fulfilling your desired capacity, EC2 Fleet will * continue to fulfill your request by drawing from the next lowest priced pool. To ensure that your desired * capacity is met, you might receive Spot Instances from several pools. Because this strategy only considers * instance price and not capacity availability, it might lead to high interruption rates. *
*
* Default: lowest-price
*
* EC2 Fleet identifies the pools with the highest capacity availability for the number of instances that are * launching. This means that we will request Spot Instances from the pools that we believe have the lowest * chance of interruption in the near term. EC2 Fleet then requests Spot Instances from the lowest priced of * these pools. *
*
* EC2 Fleet identifies the pools with the highest capacity availability for the number of instances that are
* launching. This means that we will request Spot Instances from the pools that we believe have the lowest
* chance of interruption in the near term. To give certain instance types a higher chance of launching
* first, use capacity-optimized-prioritized
. Set a priority for each instance type by using the
* Priority
parameter for LaunchTemplateOverrides
. You can assign the same priority
* to different LaunchTemplateOverrides
. EC2 implements the priorities on a best-effort basis,
* but optimizes for capacity first. capacity-optimized-prioritized
is supported only if your
* EC2 Fleet uses a launch template. Note that if the On-Demand AllocationStrategy
is set to
* prioritized
, the same priority is applied when fulfilling On-Demand capacity.
*
* EC2 Fleet requests instances from all of the Spot Instance pools that you specify. *
** EC2 Fleet requests instances from the lowest priced Spot Instance pool that has available capacity. If the * lowest priced pool doesn't have available capacity, the Spot Instances come from the next lowest priced * pool that has available capacity. If a pool runs out of capacity before fulfilling your desired capacity, * EC2 Fleet will continue to fulfill your request by drawing from the next lowest priced pool. To ensure * that your desired capacity is met, you might receive Spot Instances from several pools. Because this * strategy only considers instance price and not capacity availability, it might lead to high interruption * rates. *
*
* Default: lowest-price
* @return Returns a reference to this object so that method calls can be chained together.
* @see SpotAllocationStrategy
*/
public SpotOptionsRequest withAllocationStrategy(String allocationStrategy) {
setAllocationStrategy(allocationStrategy);
return this;
}
/**
*
* The strategy that determines how to allocate the target Spot Instance capacity across the Spot Instance pools * specified by the EC2 Fleet launch configuration. For more information, see Allocation * strategies for Spot Instances in the Amazon EC2 User Guide. *
** EC2 Fleet identifies the pools with the highest capacity availability for the number of instances that are * launching. This means that we will request Spot Instances from the pools that we believe have the lowest chance * of interruption in the near term. EC2 Fleet then requests Spot Instances from the lowest priced of these pools. *
*
* EC2 Fleet identifies the pools with the highest capacity availability for the number of instances that are
* launching. This means that we will request Spot Instances from the pools that we believe have the lowest chance
* of interruption in the near term. To give certain instance types a higher chance of launching first, use
* capacity-optimized-prioritized
. Set a priority for each instance type by using the
* Priority
parameter for LaunchTemplateOverrides
. You can assign the same priority to
* different LaunchTemplateOverrides
. EC2 implements the priorities on a best-effort basis, but
* optimizes for capacity first. capacity-optimized-prioritized
is supported only if your EC2 Fleet
* uses a launch template. Note that if the On-Demand AllocationStrategy
is set to
* prioritized
, the same priority is applied when fulfilling On-Demand capacity.
*
* EC2 Fleet requests instances from all of the Spot Instance pools that you specify. *
** EC2 Fleet requests instances from the lowest priced Spot Instance pool that has available capacity. If the lowest * priced pool doesn't have available capacity, the Spot Instances come from the next lowest priced pool that has * available capacity. If a pool runs out of capacity before fulfilling your desired capacity, EC2 Fleet will * continue to fulfill your request by drawing from the next lowest priced pool. To ensure that your desired * capacity is met, you might receive Spot Instances from several pools. Because this strategy only considers * instance price and not capacity availability, it might lead to high interruption rates. *
*
* Default: lowest-price
*
* EC2 Fleet identifies the pools with the highest capacity availability for the number of instances that are * launching. This means that we will request Spot Instances from the pools that we believe have the lowest * chance of interruption in the near term. EC2 Fleet then requests Spot Instances from the lowest priced of * these pools. *
*
* EC2 Fleet identifies the pools with the highest capacity availability for the number of instances that are
* launching. This means that we will request Spot Instances from the pools that we believe have the lowest
* chance of interruption in the near term. To give certain instance types a higher chance of launching
* first, use capacity-optimized-prioritized
. Set a priority for each instance type by using the
* Priority
parameter for LaunchTemplateOverrides
. You can assign the same priority
* to different LaunchTemplateOverrides
. EC2 implements the priorities on a best-effort basis,
* but optimizes for capacity first. capacity-optimized-prioritized
is supported only if your
* EC2 Fleet uses a launch template. Note that if the On-Demand AllocationStrategy
is set to
* prioritized
, the same priority is applied when fulfilling On-Demand capacity.
*
* EC2 Fleet requests instances from all of the Spot Instance pools that you specify. *
** EC2 Fleet requests instances from the lowest priced Spot Instance pool that has available capacity. If the * lowest priced pool doesn't have available capacity, the Spot Instances come from the next lowest priced * pool that has available capacity. If a pool runs out of capacity before fulfilling your desired capacity, * EC2 Fleet will continue to fulfill your request by drawing from the next lowest priced pool. To ensure * that your desired capacity is met, you might receive Spot Instances from several pools. Because this * strategy only considers instance price and not capacity availability, it might lead to high interruption * rates. *
*
* Default: lowest-price
* @return Returns a reference to this object so that method calls can be chained together.
* @see SpotAllocationStrategy
*/
public SpotOptionsRequest withAllocationStrategy(SpotAllocationStrategy allocationStrategy) {
this.allocationStrategy = allocationStrategy.toString();
return this;
}
/**
*
* The strategies for managing your Spot Instances that are at an elevated risk of being interrupted. *
* * @param maintenanceStrategies * The strategies for managing your Spot Instances that are at an elevated risk of being interrupted. */ public void setMaintenanceStrategies(FleetSpotMaintenanceStrategiesRequest maintenanceStrategies) { this.maintenanceStrategies = maintenanceStrategies; } /** ** The strategies for managing your Spot Instances that are at an elevated risk of being interrupted. *
* * @return The strategies for managing your Spot Instances that are at an elevated risk of being interrupted. */ public FleetSpotMaintenanceStrategiesRequest getMaintenanceStrategies() { return this.maintenanceStrategies; } /** ** The strategies for managing your Spot Instances that are at an elevated risk of being interrupted. *
* * @param maintenanceStrategies * The strategies for managing your Spot Instances that are at an elevated risk of being interrupted. * @return Returns a reference to this object so that method calls can be chained together. */ public SpotOptionsRequest withMaintenanceStrategies(FleetSpotMaintenanceStrategiesRequest maintenanceStrategies) { setMaintenanceStrategies(maintenanceStrategies); return this; } /** ** The behavior when a Spot Instance is interrupted. *
*
* Default: terminate
*
* Default: terminate
* @see SpotInstanceInterruptionBehavior
*/
public void setInstanceInterruptionBehavior(String instanceInterruptionBehavior) {
this.instanceInterruptionBehavior = instanceInterruptionBehavior;
}
/**
*
* The behavior when a Spot Instance is interrupted. *
*
* Default: terminate
*
* Default: terminate
* @see SpotInstanceInterruptionBehavior
*/
public String getInstanceInterruptionBehavior() {
return this.instanceInterruptionBehavior;
}
/**
*
* The behavior when a Spot Instance is interrupted. *
*
* Default: terminate
*
* Default: terminate
* @return Returns a reference to this object so that method calls can be chained together.
* @see SpotInstanceInterruptionBehavior
*/
public SpotOptionsRequest withInstanceInterruptionBehavior(String instanceInterruptionBehavior) {
setInstanceInterruptionBehavior(instanceInterruptionBehavior);
return this;
}
/**
*
* The behavior when a Spot Instance is interrupted. *
*
* Default: terminate
*
* Default: terminate
* @return Returns a reference to this object so that method calls can be chained together.
* @see SpotInstanceInterruptionBehavior
*/
public SpotOptionsRequest withInstanceInterruptionBehavior(SpotInstanceInterruptionBehavior instanceInterruptionBehavior) {
this.instanceInterruptionBehavior = instanceInterruptionBehavior.toString();
return this;
}
/**
*
* The number of Spot pools across which to allocate your target Spot capacity. Supported only when Spot
* AllocationStrategy
is set to lowest-price
. EC2 Fleet selects the cheapest Spot pools
* and evenly allocates your target Spot capacity across the number of Spot pools that you specify.
*
* Note that EC2 Fleet attempts to draw Spot Instances from the number of pools that you specify on a best effort * basis. If a pool runs out of Spot capacity before fulfilling your target capacity, EC2 Fleet will continue to * fulfill your request by drawing from the next cheapest pool. To ensure that your target capacity is met, you * might receive Spot Instances from more than the number of pools that you specified. Similarly, if most of the * pools have no Spot capacity, you might receive your full target capacity from fewer than the number of pools that * you specified. *
* * @param instancePoolsToUseCount * The number of Spot pools across which to allocate your target Spot capacity. Supported only when Spot *AllocationStrategy
is set to lowest-price
. EC2 Fleet selects the cheapest Spot
* pools and evenly allocates your target Spot capacity across the number of Spot pools that you specify.
* * Note that EC2 Fleet attempts to draw Spot Instances from the number of pools that you specify on a best * effort basis. If a pool runs out of Spot capacity before fulfilling your target capacity, EC2 Fleet will * continue to fulfill your request by drawing from the next cheapest pool. To ensure that your target * capacity is met, you might receive Spot Instances from more than the number of pools that you specified. * Similarly, if most of the pools have no Spot capacity, you might receive your full target capacity from * fewer than the number of pools that you specified. */ public void setInstancePoolsToUseCount(Integer instancePoolsToUseCount) { this.instancePoolsToUseCount = instancePoolsToUseCount; } /** *
* The number of Spot pools across which to allocate your target Spot capacity. Supported only when Spot
* AllocationStrategy
is set to lowest-price
. EC2 Fleet selects the cheapest Spot pools
* and evenly allocates your target Spot capacity across the number of Spot pools that you specify.
*
* Note that EC2 Fleet attempts to draw Spot Instances from the number of pools that you specify on a best effort * basis. If a pool runs out of Spot capacity before fulfilling your target capacity, EC2 Fleet will continue to * fulfill your request by drawing from the next cheapest pool. To ensure that your target capacity is met, you * might receive Spot Instances from more than the number of pools that you specified. Similarly, if most of the * pools have no Spot capacity, you might receive your full target capacity from fewer than the number of pools that * you specified. *
* * @return The number of Spot pools across which to allocate your target Spot capacity. Supported only when Spot *AllocationStrategy
is set to lowest-price
. EC2 Fleet selects the cheapest Spot
* pools and evenly allocates your target Spot capacity across the number of Spot pools that you
* specify.
* * Note that EC2 Fleet attempts to draw Spot Instances from the number of pools that you specify on a best * effort basis. If a pool runs out of Spot capacity before fulfilling your target capacity, EC2 Fleet will * continue to fulfill your request by drawing from the next cheapest pool. To ensure that your target * capacity is met, you might receive Spot Instances from more than the number of pools that you specified. * Similarly, if most of the pools have no Spot capacity, you might receive your full target capacity from * fewer than the number of pools that you specified. */ public Integer getInstancePoolsToUseCount() { return this.instancePoolsToUseCount; } /** *
* The number of Spot pools across which to allocate your target Spot capacity. Supported only when Spot
* AllocationStrategy
is set to lowest-price
. EC2 Fleet selects the cheapest Spot pools
* and evenly allocates your target Spot capacity across the number of Spot pools that you specify.
*
* Note that EC2 Fleet attempts to draw Spot Instances from the number of pools that you specify on a best effort * basis. If a pool runs out of Spot capacity before fulfilling your target capacity, EC2 Fleet will continue to * fulfill your request by drawing from the next cheapest pool. To ensure that your target capacity is met, you * might receive Spot Instances from more than the number of pools that you specified. Similarly, if most of the * pools have no Spot capacity, you might receive your full target capacity from fewer than the number of pools that * you specified. *
* * @param instancePoolsToUseCount * The number of Spot pools across which to allocate your target Spot capacity. Supported only when Spot *AllocationStrategy
is set to lowest-price
. EC2 Fleet selects the cheapest Spot
* pools and evenly allocates your target Spot capacity across the number of Spot pools that you specify.
* * Note that EC2 Fleet attempts to draw Spot Instances from the number of pools that you specify on a best * effort basis. If a pool runs out of Spot capacity before fulfilling your target capacity, EC2 Fleet will * continue to fulfill your request by drawing from the next cheapest pool. To ensure that your target * capacity is met, you might receive Spot Instances from more than the number of pools that you specified. * Similarly, if most of the pools have no Spot capacity, you might receive your full target capacity from * fewer than the number of pools that you specified. * @return Returns a reference to this object so that method calls can be chained together. */ public SpotOptionsRequest withInstancePoolsToUseCount(Integer instancePoolsToUseCount) { setInstancePoolsToUseCount(instancePoolsToUseCount); return this; } /** *
* Indicates that the fleet uses a single instance type to launch all Spot Instances in the fleet. *
*
* Supported only for fleets of type instant
.
*
* Supported only for fleets of type instant
.
*/
public void setSingleInstanceType(Boolean singleInstanceType) {
this.singleInstanceType = singleInstanceType;
}
/**
*
* Indicates that the fleet uses a single instance type to launch all Spot Instances in the fleet. *
*
* Supported only for fleets of type instant
.
*
* Supported only for fleets of type instant
.
*/
public Boolean getSingleInstanceType() {
return this.singleInstanceType;
}
/**
*
* Indicates that the fleet uses a single instance type to launch all Spot Instances in the fleet. *
*
* Supported only for fleets of type instant
.
*
* Supported only for fleets of type instant
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SpotOptionsRequest withSingleInstanceType(Boolean singleInstanceType) {
setSingleInstanceType(singleInstanceType);
return this;
}
/**
*
* Indicates that the fleet uses a single instance type to launch all Spot Instances in the fleet. *
*
* Supported only for fleets of type instant
.
*
* Supported only for fleets of type instant
.
*/
public Boolean isSingleInstanceType() {
return this.singleInstanceType;
}
/**
*
* Indicates that the fleet launches all Spot Instances into a single Availability Zone. *
*
* Supported only for fleets of type instant
.
*
* Supported only for fleets of type instant
.
*/
public void setSingleAvailabilityZone(Boolean singleAvailabilityZone) {
this.singleAvailabilityZone = singleAvailabilityZone;
}
/**
*
* Indicates that the fleet launches all Spot Instances into a single Availability Zone. *
*
* Supported only for fleets of type instant
.
*
* Supported only for fleets of type instant
.
*/
public Boolean getSingleAvailabilityZone() {
return this.singleAvailabilityZone;
}
/**
*
* Indicates that the fleet launches all Spot Instances into a single Availability Zone. *
*
* Supported only for fleets of type instant
.
*
* Supported only for fleets of type instant
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SpotOptionsRequest withSingleAvailabilityZone(Boolean singleAvailabilityZone) {
setSingleAvailabilityZone(singleAvailabilityZone);
return this;
}
/**
*
* Indicates that the fleet launches all Spot Instances into a single Availability Zone. *
*
* Supported only for fleets of type instant
.
*
* Supported only for fleets of type instant
.
*/
public Boolean isSingleAvailabilityZone() {
return this.singleAvailabilityZone;
}
/**
*
* The minimum target capacity for Spot Instances in the fleet. If the minimum target capacity is not reached, the * fleet launches no instances. *
*
* Supported only for fleets of type instant
.
*
* At least one of the following must be specified: SingleAvailabilityZone
|
* SingleInstanceType
*
* Supported only for fleets of type instant
.
*
* At least one of the following must be specified: SingleAvailabilityZone
|
* SingleInstanceType
*/
public void setMinTargetCapacity(Integer minTargetCapacity) {
this.minTargetCapacity = minTargetCapacity;
}
/**
*
* The minimum target capacity for Spot Instances in the fleet. If the minimum target capacity is not reached, the * fleet launches no instances. *
*
* Supported only for fleets of type instant
.
*
* At least one of the following must be specified: SingleAvailabilityZone
|
* SingleInstanceType
*
* Supported only for fleets of type instant
.
*
* At least one of the following must be specified: SingleAvailabilityZone
|
* SingleInstanceType
*/
public Integer getMinTargetCapacity() {
return this.minTargetCapacity;
}
/**
*
* The minimum target capacity for Spot Instances in the fleet. If the minimum target capacity is not reached, the * fleet launches no instances. *
*
* Supported only for fleets of type instant
.
*
* At least one of the following must be specified: SingleAvailabilityZone
|
* SingleInstanceType
*
* Supported only for fleets of type instant
.
*
* At least one of the following must be specified: SingleAvailabilityZone
|
* SingleInstanceType
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SpotOptionsRequest withMinTargetCapacity(Integer minTargetCapacity) {
setMinTargetCapacity(minTargetCapacity);
return this;
}
/**
*
* The maximum amount per hour for Spot Instances that you're willing to pay. We do not recommend using this * parameter because it can lead to increased interruptions. If you do not specify this parameter, you will pay the * current Spot price. *
** If you specify a maximum price, your Spot Instances will be interrupted more frequently than if you do not * specify this parameter. *
** If you specify a maximum price, your Spot Instances will be interrupted more frequently than if you do not * specify this parameter. *
*/ public void setMaxTotalPrice(String maxTotalPrice) { this.maxTotalPrice = maxTotalPrice; } /** ** The maximum amount per hour for Spot Instances that you're willing to pay. We do not recommend using this * parameter because it can lead to increased interruptions. If you do not specify this parameter, you will pay the * current Spot price. *
** If you specify a maximum price, your Spot Instances will be interrupted more frequently than if you do not * specify this parameter. *
** If you specify a maximum price, your Spot Instances will be interrupted more frequently than if you do * not specify this parameter. *
*/ public String getMaxTotalPrice() { return this.maxTotalPrice; } /** ** The maximum amount per hour for Spot Instances that you're willing to pay. We do not recommend using this * parameter because it can lead to increased interruptions. If you do not specify this parameter, you will pay the * current Spot price. *
** If you specify a maximum price, your Spot Instances will be interrupted more frequently than if you do not * specify this parameter. *
** If you specify a maximum price, your Spot Instances will be interrupted more frequently than if you do not * specify this parameter. *
* @return Returns a reference to this object so that method calls can be chained together. */ public SpotOptionsRequest withMaxTotalPrice(String maxTotalPrice) { setMaxTotalPrice(maxTotalPrice); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getAllocationStrategy() != null) sb.append("AllocationStrategy: ").append(getAllocationStrategy()).append(","); if (getMaintenanceStrategies() != null) sb.append("MaintenanceStrategies: ").append(getMaintenanceStrategies()).append(","); if (getInstanceInterruptionBehavior() != null) sb.append("InstanceInterruptionBehavior: ").append(getInstanceInterruptionBehavior()).append(","); if (getInstancePoolsToUseCount() != null) sb.append("InstancePoolsToUseCount: ").append(getInstancePoolsToUseCount()).append(","); if (getSingleInstanceType() != null) sb.append("SingleInstanceType: ").append(getSingleInstanceType()).append(","); if (getSingleAvailabilityZone() != null) sb.append("SingleAvailabilityZone: ").append(getSingleAvailabilityZone()).append(","); if (getMinTargetCapacity() != null) sb.append("MinTargetCapacity: ").append(getMinTargetCapacity()).append(","); if (getMaxTotalPrice() != null) sb.append("MaxTotalPrice: ").append(getMaxTotalPrice()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof SpotOptionsRequest == false) return false; SpotOptionsRequest other = (SpotOptionsRequest) obj; if (other.getAllocationStrategy() == null ^ this.getAllocationStrategy() == null) return false; if (other.getAllocationStrategy() != null && other.getAllocationStrategy().equals(this.getAllocationStrategy()) == false) return false; if (other.getMaintenanceStrategies() == null ^ this.getMaintenanceStrategies() == null) return false; if (other.getMaintenanceStrategies() != null && other.getMaintenanceStrategies().equals(this.getMaintenanceStrategies()) == false) return false; if (other.getInstanceInterruptionBehavior() == null ^ this.getInstanceInterruptionBehavior() == null) return false; if (other.getInstanceInterruptionBehavior() != null && other.getInstanceInterruptionBehavior().equals(this.getInstanceInterruptionBehavior()) == false) return false; if (other.getInstancePoolsToUseCount() == null ^ this.getInstancePoolsToUseCount() == null) return false; if (other.getInstancePoolsToUseCount() != null && other.getInstancePoolsToUseCount().equals(this.getInstancePoolsToUseCount()) == false) return false; if (other.getSingleInstanceType() == null ^ this.getSingleInstanceType() == null) return false; if (other.getSingleInstanceType() != null && other.getSingleInstanceType().equals(this.getSingleInstanceType()) == false) return false; if (other.getSingleAvailabilityZone() == null ^ this.getSingleAvailabilityZone() == null) return false; if (other.getSingleAvailabilityZone() != null && other.getSingleAvailabilityZone().equals(this.getSingleAvailabilityZone()) == false) return false; if (other.getMinTargetCapacity() == null ^ this.getMinTargetCapacity() == null) return false; if (other.getMinTargetCapacity() != null && other.getMinTargetCapacity().equals(this.getMinTargetCapacity()) == false) return false; if (other.getMaxTotalPrice() == null ^ this.getMaxTotalPrice() == null) return false; if (other.getMaxTotalPrice() != null && other.getMaxTotalPrice().equals(this.getMaxTotalPrice()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getAllocationStrategy() == null) ? 0 : getAllocationStrategy().hashCode()); hashCode = prime * hashCode + ((getMaintenanceStrategies() == null) ? 0 : getMaintenanceStrategies().hashCode()); hashCode = prime * hashCode + ((getInstanceInterruptionBehavior() == null) ? 0 : getInstanceInterruptionBehavior().hashCode()); hashCode = prime * hashCode + ((getInstancePoolsToUseCount() == null) ? 0 : getInstancePoolsToUseCount().hashCode()); hashCode = prime * hashCode + ((getSingleInstanceType() == null) ? 0 : getSingleInstanceType().hashCode()); hashCode = prime * hashCode + ((getSingleAvailabilityZone() == null) ? 0 : getSingleAvailabilityZone().hashCode()); hashCode = prime * hashCode + ((getMinTargetCapacity() == null) ? 0 : getMinTargetCapacity().hashCode()); hashCode = prime * hashCode + ((getMaxTotalPrice() == null) ? 0 : getMaxTotalPrice().hashCode()); return hashCode; } @Override public SpotOptionsRequest clone() { try { return (SpotOptionsRequest) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }