Class: AWSCDK::EC2::CfnEC2Fleet::SpotOptionsRequestProperty
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::EC2::CfnEC2Fleet::SpotOptionsRequestProperty
- Defined in:
- ec2/cfn_ec2_fleet.rb
Overview
Specifies the configuration of Spot Instances for an EC2 Fleet.
SpotOptionsRequest is a property of the AWS::EC2::EC2Fleet resource.
Instance Attribute Summary collapse
-
#allocation_strategy ⇒ String?
readonly
Indicates how to allocate the target Spot Instance capacity across the Spot Instance pools specified by the EC2 Fleet.
-
#instance_interruption_behavior ⇒ String?
readonly
The behavior when a Spot Instance is interrupted.
-
#instance_pools_to_use_count ⇒ Numeric?
readonly
The number of Spot pools across which to allocate your target Spot capacity.
-
#maintenance_strategies ⇒ AWSCDK::IResolvable, ...
readonly
The strategies for managing your Spot Instances that are at an elevated risk of being interrupted.
-
#max_total_price ⇒ String?
readonly
The maximum amount per hour for Spot Instances that you're willing to pay.
-
#min_target_capacity ⇒ Numeric?
readonly
The minimum target capacity for Spot Instances in the fleet.
-
#single_availability_zone ⇒ Boolean, ...
readonly
Indicates that the fleet launches all Spot Instances into a single Availability Zone.
-
#single_instance_type ⇒ Boolean, ...
readonly
Indicates that the fleet uses a single instance type to launch all Spot Instances in the fleet.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(allocation_strategy: nil, instance_interruption_behavior: nil, instance_pools_to_use_count: nil, maintenance_strategies: nil, max_total_price: nil, min_target_capacity: nil, single_availability_zone: nil, single_instance_type: nil) ⇒ SpotOptionsRequestProperty
constructor
A new instance of SpotOptionsRequestProperty.
- #to_jsii ⇒ Object
Constructor Details
#initialize(allocation_strategy: nil, instance_interruption_behavior: nil, instance_pools_to_use_count: nil, maintenance_strategies: nil, max_total_price: nil, min_target_capacity: nil, single_availability_zone: nil, single_instance_type: nil) ⇒ SpotOptionsRequestProperty
Returns a new instance of SpotOptionsRequestProperty.
2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 |
# File 'ec2/cfn_ec2_fleet.rb', line 2812 def initialize(allocation_strategy: nil, instance_interruption_behavior: nil, instance_pools_to_use_count: nil, maintenance_strategies: nil, max_total_price: nil, min_target_capacity: nil, single_availability_zone: nil, single_instance_type: nil) @allocation_strategy = allocation_strategy Jsii::Type.check_type(@allocation_strategy, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "allocationStrategy") unless @allocation_strategy.nil? @instance_interruption_behavior = instance_interruption_behavior Jsii::Type.check_type(@instance_interruption_behavior, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "instanceInterruptionBehavior") unless @instance_interruption_behavior.nil? @instance_pools_to_use_count = instance_pools_to_use_count Jsii::Type.check_type(@instance_pools_to_use_count, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "instancePoolsToUseCount") unless @instance_pools_to_use_count.nil? @maintenance_strategies = maintenance_strategies.is_a?(Hash) ? ::AWSCDK::EC2::CfnEC2Fleet::MaintenanceStrategiesProperty.new(**maintenance_strategies.transform_keys(&:to_sym)) : maintenance_strategies Jsii::Type.check_type(@maintenance_strategies, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuRUMyRmxlZXQuTWFpbnRlbmFuY2VTdHJhdGVnaWVzUHJvcGVydHkifV19fQ==")), "maintenanceStrategies") unless @maintenance_strategies.nil? @max_total_price = max_total_price Jsii::Type.check_type(@max_total_price, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "maxTotalPrice") unless @max_total_price.nil? @min_target_capacity = min_target_capacity Jsii::Type.check_type(@min_target_capacity, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "minTargetCapacity") unless @min_target_capacity.nil? @single_availability_zone = single_availability_zone Jsii::Type.check_type(@single_availability_zone, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "singleAvailabilityZone") unless @single_availability_zone.nil? @single_instance_type = single_instance_type Jsii::Type.check_type(@single_instance_type, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "singleInstanceType") unless @single_instance_type.nil? end |
Instance Attribute Details
#allocation_strategy ⇒ String? (readonly)
Indicates how to allocate the target Spot Instance capacity across the Spot Instance pools specified by the EC2 Fleet.
If the allocation strategy is lowest_price , EC2 Fleet launches instances from the Spot Instance pools with the lowest price. This is the default allocation strategy.
If the allocation strategy is diversified , EC2 Fleet launches instances from all the Spot Instance pools that you specify.
If the allocation strategy is capacity_optimized , EC2 Fleet launches instances from Spot Instance pools that are optimally chosen based on the available Spot Instance capacity.
Allowed Values : lowest_price | diversified | capacity_optimized | capacity_optimized_prioritized
2843 2844 2845 |
# File 'ec2/cfn_ec2_fleet.rb', line 2843 def allocation_strategy @allocation_strategy end |
#instance_interruption_behavior ⇒ String? (readonly)
The behavior when a Spot Instance is interrupted.
Default: terminate
2850 2851 2852 |
# File 'ec2/cfn_ec2_fleet.rb', line 2850 def instance_interruption_behavior @instance_interruption_behavior end |
#instance_pools_to_use_count ⇒ Numeric? (readonly)
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.
2859 2860 2861 |
# File 'ec2/cfn_ec2_fleet.rb', line 2859 def instance_pools_to_use_count @instance_pools_to_use_count end |
#maintenance_strategies ⇒ AWSCDK::IResolvable, ... (readonly)
The strategies for managing your Spot Instances that are at an elevated risk of being interrupted.
2864 2865 2866 |
# File 'ec2/cfn_ec2_fleet.rb', line 2864 def maintenance_strategies @maintenance_strategies end |
#max_total_price ⇒ String? (readonly)
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 your fleet includes T instances that are configured as
unlimited, and if their average CPU usage exceeds the baseline utilization, you will incur a charge for surplus credits. TheMaxTotalPricedoes not account for surplus credits, and, if you use surplus credits, your final cost might be higher than what you specified forMaxTotalPrice. For more information, see Surplus credits can incur charges in the Amazon EC2 User Guide .
2873 2874 2875 |
# File 'ec2/cfn_ec2_fleet.rb', line 2873 def max_total_price @max_total_price end |
#min_target_capacity ⇒ Numeric? (readonly)
The minimum target capacity for Spot Instances in the fleet.
If this minimum capacity isn't reached, no instances are launched.
Constraints: Maximum value of 1000 . Supported only for fleets of type instant .
At least one of the following must be specified: SingleAvailabilityZone | SingleInstanceType
2884 2885 2886 |
# File 'ec2/cfn_ec2_fleet.rb', line 2884 def min_target_capacity @min_target_capacity end |
#single_availability_zone ⇒ Boolean, ... (readonly)
Indicates that the fleet launches all Spot Instances into a single Availability Zone.
Supported only for fleets of type instant .
2891 2892 2893 |
# File 'ec2/cfn_ec2_fleet.rb', line 2891 def single_availability_zone @single_availability_zone end |
#single_instance_type ⇒ Boolean, ... (readonly)
Indicates that the fleet uses a single instance type to launch all Spot Instances in the fleet.
Supported only for fleets of type instant .
2898 2899 2900 |
# File 'ec2/cfn_ec2_fleet.rb', line 2898 def single_instance_type @single_instance_type end |
Class Method Details
.jsii_properties ⇒ Object
2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 |
# File 'ec2/cfn_ec2_fleet.rb', line 2900 def self.jsii_properties { :allocation_strategy => "allocationStrategy", :instance_interruption_behavior => "instanceInterruptionBehavior", :instance_pools_to_use_count => "instancePoolsToUseCount", :maintenance_strategies => "maintenanceStrategies", :max_total_price => "maxTotalPrice", :min_target_capacity => "minTargetCapacity", :single_availability_zone => "singleAvailabilityZone", :single_instance_type => "singleInstanceType", } end |
Instance Method Details
#to_jsii ⇒ Object
2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 |
# File 'ec2/cfn_ec2_fleet.rb', line 2913 def to_jsii result = {} result.merge!({ "allocationStrategy" => @allocation_strategy, "instanceInterruptionBehavior" => @instance_interruption_behavior, "instancePoolsToUseCount" => @instance_pools_to_use_count, "maintenanceStrategies" => @maintenance_strategies, "maxTotalPrice" => @max_total_price, "minTargetCapacity" => @min_target_capacity, "singleAvailabilityZone" => @single_availability_zone, "singleInstanceType" => @single_instance_type, }) result.compact end |