Struct aws_sdk_ec2::model::SpotOptions
source · #[non_exhaustive]pub struct SpotOptions { /* private fields */ }
Expand description
Describes the configuration of Spot Instances in an EC2 Fleet.
Implementations§
source§impl SpotOptions
impl SpotOptions
sourcepub fn allocation_strategy(&self) -> Option<&SpotAllocationStrategy>
pub fn allocation_strategy(&self) -> Option<&SpotAllocationStrategy>
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.
lowest-price
- EC2 Fleet launches instances from the lowest-price Spot Instance pool that has available capacity. If the cheapest pool doesn't have available capacity, the Spot Instances come from the next cheapest 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 cheapest pool. To ensure that your desired capacity is met, you might receive Spot Instances from several pools.
diversified
- EC2 Fleet launches instances from all of the Spot Instance pools that you specify.
capacity-optimized
(recommended) - EC2 Fleet launches instances from Spot Instance pools with optimal capacity for the number of instances that are launching. 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 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.
Default: lowest-price
sourcepub fn maintenance_strategies(&self) -> Option<&FleetSpotMaintenanceStrategies>
pub fn maintenance_strategies(&self) -> Option<&FleetSpotMaintenanceStrategies>
The strategies for managing your workloads on your Spot Instances that will be interrupted. Currently only the capacity rebalance strategy is available.
sourcepub fn instance_interruption_behavior(
&self
) -> Option<&SpotInstanceInterruptionBehavior>
pub fn instance_interruption_behavior(
&self
) -> Option<&SpotInstanceInterruptionBehavior>
The behavior when a Spot Instance is interrupted.
Default: terminate
sourcepub fn instance_pools_to_use_count(&self) -> Option<i32>
pub fn instance_pools_to_use_count(&self) -> Option<i32>
The number of Spot pools across which to allocate your target Spot capacity. Supported only when 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.
sourcepub fn single_instance_type(&self) -> Option<bool>
pub fn single_instance_type(&self) -> Option<bool>
Indicates that the fleet uses a single instance type to launch all Spot Instances in the fleet.
Supported only for fleets of type instant
.
sourcepub fn single_availability_zone(&self) -> Option<bool>
pub fn single_availability_zone(&self) -> Option<bool>
Indicates that the fleet launches all Spot Instances into a single Availability Zone.
Supported only for fleets of type instant
.
sourcepub fn min_target_capacity(&self) -> Option<i32>
pub fn min_target_capacity(&self) -> Option<i32>
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
sourcepub fn max_total_price(&self) -> Option<&str>
pub fn max_total_price(&self) -> Option<&str>
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.
source§impl SpotOptions
impl SpotOptions
sourcepub fn builder() -> Builder
pub fn builder() -> Builder
Creates a new builder-style object to manufacture SpotOptions
.
Examples found in repository?
58601 58602 58603 58604 58605 58606 58607 58608 58609 58610 58611 58612 58613 58614 58615 58616 58617 58618 58619 58620 58621 58622 58623 58624 58625 58626 58627 58628 58629 58630 58631 58632 58633 58634 58635 58636 58637 58638 58639 58640 58641 58642 58643 58644 58645 58646 58647 58648 58649 58650 58651 58652 58653 58654 58655 58656 58657 58658 58659 58660 58661 58662 58663 58664 58665 58666 58667 58668 58669 58670 58671 58672 58673 58674 58675 58676 58677 58678 58679 58680 58681 58682 58683 58684 58685 58686 58687 58688 58689 58690 58691 58692 58693 58694 58695 58696 58697 58698 58699 58700 58701 58702 58703 58704 58705 58706 58707 58708 58709 58710 58711 58712 58713 58714 58715 58716 58717 58718 58719 58720 58721 58722 58723
pub fn deser_structure_crate_model_spot_options(
decoder: &mut aws_smithy_xml::decode::ScopedDecoder,
) -> Result<crate::model::SpotOptions, aws_smithy_xml::decode::XmlDecodeError> {
#[allow(unused_mut)]
let mut builder = crate::model::SpotOptions::builder();
while let Some(mut tag) = decoder.next_tag() {
match tag.start_el() {
s if s.matches("allocationStrategy") /* AllocationStrategy com.amazonaws.ec2#SpotOptions$AllocationStrategy */ => {
let var_2853 =
Some(
Result::<crate::model::SpotAllocationStrategy, aws_smithy_xml::decode::XmlDecodeError>::Ok(
crate::model::SpotAllocationStrategy::from(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
)
?
)
;
builder = builder.set_allocation_strategy(var_2853);
}
,
s if s.matches("maintenanceStrategies") /* MaintenanceStrategies com.amazonaws.ec2#SpotOptions$MaintenanceStrategies */ => {
let var_2854 =
Some(
crate::xml_deser::deser_structure_crate_model_fleet_spot_maintenance_strategies(&mut tag)
?
)
;
builder = builder.set_maintenance_strategies(var_2854);
}
,
s if s.matches("instanceInterruptionBehavior") /* InstanceInterruptionBehavior com.amazonaws.ec2#SpotOptions$InstanceInterruptionBehavior */ => {
let var_2855 =
Some(
Result::<crate::model::SpotInstanceInterruptionBehavior, aws_smithy_xml::decode::XmlDecodeError>::Ok(
crate::model::SpotInstanceInterruptionBehavior::from(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
)
?
)
;
builder = builder.set_instance_interruption_behavior(var_2855);
}
,
s if s.matches("instancePoolsToUseCount") /* InstancePoolsToUseCount com.amazonaws.ec2#SpotOptions$InstancePoolsToUseCount */ => {
let var_2856 =
Some(
{
<i32 as aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
.map_err(|_|aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
}
?
)
;
builder = builder.set_instance_pools_to_use_count(var_2856);
}
,
s if s.matches("singleInstanceType") /* SingleInstanceType com.amazonaws.ec2#SpotOptions$SingleInstanceType */ => {
let var_2857 =
Some(
{
<bool as aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
.map_err(|_|aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
}
?
)
;
builder = builder.set_single_instance_type(var_2857);
}
,
s if s.matches("singleAvailabilityZone") /* SingleAvailabilityZone com.amazonaws.ec2#SpotOptions$SingleAvailabilityZone */ => {
let var_2858 =
Some(
{
<bool as aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
.map_err(|_|aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
}
?
)
;
builder = builder.set_single_availability_zone(var_2858);
}
,
s if s.matches("minTargetCapacity") /* MinTargetCapacity com.amazonaws.ec2#SpotOptions$MinTargetCapacity */ => {
let var_2859 =
Some(
{
<i32 as aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
.map_err(|_|aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
}
?
)
;
builder = builder.set_min_target_capacity(var_2859);
}
,
s if s.matches("maxTotalPrice") /* MaxTotalPrice com.amazonaws.ec2#SpotOptions$MaxTotalPrice */ => {
let var_2860 =
Some(
Result::<std::string::String, aws_smithy_xml::decode::XmlDecodeError>::Ok(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
.into()
)
?
)
;
builder = builder.set_max_total_price(var_2860);
}
,
_ => {}
}
}
Ok(builder.build())
}
Trait Implementations§
source§impl Clone for SpotOptions
impl Clone for SpotOptions
source§fn clone(&self) -> SpotOptions
fn clone(&self) -> SpotOptions
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more