Class: AWSCDK::EC2::CfnSpotFleet::SpotFleetRequestConfigDataProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ec2/cfn_spot_fleet.rb

Overview

Specifies the configuration of a Spot Fleet request.

For more information, see Spot Fleet in the Amazon EC2 User Guide .

You must specify either LaunchSpecifications or LaunchTemplateConfigs .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(iam_fleet_role:, target_capacity:, allocation_strategy: nil, context: nil, excess_capacity_termination_policy: nil, instance_interruption_behavior: nil, instance_pools_to_use_count: nil, launch_specifications: nil, launch_template_configs: nil, load_balancers_config: nil, on_demand_allocation_strategy: nil, on_demand_max_total_price: nil, on_demand_target_capacity: nil, replace_unhealthy_instances: nil, spot_maintenance_strategies: nil, spot_max_total_price: nil, spot_price: nil, tag_specifications: nil, target_capacity_unit_type: nil, terminate_instances_with_expiration: nil, type: nil, valid_from: nil, valid_until: nil) ⇒ SpotFleetRequestConfigDataProperty

Returns a new instance of SpotFleetRequestConfigDataProperty.

Parameters:

  • iam_fleet_role (String)

    The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM) role that grants the Spot Fleet the permission to request, launch, terminate, and tag instances on your behalf.

  • target_capacity (Numeric)

    The number of units to request for the Spot Fleet.

  • allocation_strategy (String, nil) (defaults to: nil)

    The strategy that determines how to allocate the target Spot Instance capacity across the Spot Instance pools specified by the Spot Fleet launch configuration.

  • context (String, nil) (defaults to: nil)

    Reserved.

  • excess_capacity_termination_policy (String, nil) (defaults to: nil)

    Indicates whether running Spot Instances should be terminated if you decrease the target capacity of the Spot Fleet request below the current size of the Spot Fleet.

  • instance_interruption_behavior (String, nil) (defaults to: nil)

    The behavior when a Spot Instance is interrupted.

  • instance_pools_to_use_count (Numeric, nil) (defaults to: nil)

    The number of Spot pools across which to allocate your target Spot capacity.

  • launch_specifications (AWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::EC2::CfnSpotFleet::SpotFleetLaunchSpecificationProperty>, nil) (defaults to: nil)

    The launch specifications for the Spot Fleet request.

  • launch_template_configs (AWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::EC2::CfnSpotFleet::LaunchTemplateConfigProperty>, nil) (defaults to: nil)

    The launch template and overrides.

  • load_balancers_config (AWSCDK::IResolvable, AWSCDK::EC2::CfnSpotFleet::LoadBalancersConfigProperty, nil) (defaults to: nil)

    One or more Classic Load Balancers and target groups to attach to the Spot Fleet request.

  • on_demand_allocation_strategy (String, nil) (defaults to: nil)

    The order of the launch template overrides to use in fulfilling On-Demand capacity.

  • on_demand_max_total_price (String, nil) (defaults to: nil)

    The maximum amount per hour for On-Demand Instances that you're willing to pay.

  • on_demand_target_capacity (Numeric, nil) (defaults to: nil)

    The number of On-Demand units to request.

  • replace_unhealthy_instances (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Indicates whether Spot Fleet should replace unhealthy instances.

  • spot_maintenance_strategies (AWSCDK::IResolvable, AWSCDK::EC2::CfnSpotFleet::SpotMaintenanceStrategiesProperty, nil) (defaults to: nil)

    The strategies for managing your Spot Instances that are at an elevated risk of being interrupted.

  • spot_max_total_price (String, nil) (defaults to: nil)

    The maximum amount per hour for Spot Instances that you're willing to pay.

  • spot_price (String, nil) (defaults to: nil)

    The maximum price per unit hour that you are willing to pay for a Spot Instance.

  • tag_specifications (AWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::EC2::CfnSpotFleet::SpotFleetTagSpecificationProperty>, nil) (defaults to: nil)

    The key-value pair for tagging the Spot Fleet request on creation.

  • target_capacity_unit_type (String, nil) (defaults to: nil)

    The unit for the target capacity. You can specify this parameter only when using attribute-based instance type selection.

  • terminate_instances_with_expiration (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Indicates whether running Spot Instances are terminated when the Spot Fleet request expires.

  • type (String, nil) (defaults to: nil)

    The type of request.

  • valid_from (String, nil) (defaults to: nil)

    The start date and time of the request, in UTC format ( YYYY - MM - DD T HH : MM : SS Z).

  • valid_until (String, nil) (defaults to: nil)

    The end date and time of the request, in UTC format ( YYYY - MM - DD T HH : MM : SS Z).



2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
# File 'ec2/cfn_spot_fleet.rb', line 2651

def initialize(iam_fleet_role:, target_capacity:, allocation_strategy: nil, context: nil, excess_capacity_termination_policy: nil, instance_interruption_behavior: nil, instance_pools_to_use_count: nil, launch_specifications: nil, launch_template_configs: nil, load_balancers_config: nil, on_demand_allocation_strategy: nil, on_demand_max_total_price: nil, on_demand_target_capacity: nil, replace_unhealthy_instances: nil, spot_maintenance_strategies: nil, spot_max_total_price: nil, spot_price: nil, tag_specifications: nil, target_capacity_unit_type: nil, terminate_instances_with_expiration: nil, type: nil, valid_from: nil, valid_until: nil)
  @iam_fleet_role = iam_fleet_role
  Jsii::Type.check_type(@iam_fleet_role, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "iamFleetRole")
  @target_capacity = target_capacity
  Jsii::Type.check_type(@target_capacity, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "targetCapacity")
  @allocation_strategy = allocation_strategy
  Jsii::Type.check_type(@allocation_strategy, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "allocationStrategy") unless @allocation_strategy.nil?
  @context = context
  Jsii::Type.check_type(@context, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "context") unless @context.nil?
  @excess_capacity_termination_policy = excess_capacity_termination_policy
  Jsii::Type.check_type(@excess_capacity_termination_policy, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "excessCapacityTerminationPolicy") unless @excess_capacity_termination_policy.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?
  @launch_specifications = launch_specifications
  Jsii::Type.check_type(@launch_specifications, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNmblNwb3RGbGVldC5TcG90RmxlZXRMYXVuY2hTcGVjaWZpY2F0aW9uUHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "launchSpecifications") unless @launch_specifications.nil?
  @launch_template_configs = launch_template_configs
  Jsii::Type.check_type(@launch_template_configs, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNmblNwb3RGbGVldC5MYXVuY2hUZW1wbGF0ZUNvbmZpZ1Byb3BlcnR5In1dfX0sImtpbmQiOiJhcnJheSJ9fV19fQ==")), "launchTemplateConfigs") unless @launch_template_configs.nil?
  @load_balancers_config = load_balancers_config.is_a?(Hash) ? ::AWSCDK::EC2::CfnSpotFleet::LoadBalancersConfigProperty.new(**load_balancers_config.transform_keys(&:to_sym)) : load_balancers_config
  Jsii::Type.check_type(@load_balancers_config, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuU3BvdEZsZWV0LkxvYWRCYWxhbmNlcnNDb25maWdQcm9wZXJ0eSJ9XX19")), "loadBalancersConfig") unless @load_balancers_config.nil?
  @on_demand_allocation_strategy = on_demand_allocation_strategy
  Jsii::Type.check_type(@on_demand_allocation_strategy, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "onDemandAllocationStrategy") unless @on_demand_allocation_strategy.nil?
  @on_demand_max_total_price = on_demand_max_total_price
  Jsii::Type.check_type(@on_demand_max_total_price, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "onDemandMaxTotalPrice") unless @on_demand_max_total_price.nil?
  @on_demand_target_capacity = on_demand_target_capacity
  Jsii::Type.check_type(@on_demand_target_capacity, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "onDemandTargetCapacity") unless @on_demand_target_capacity.nil?
  @replace_unhealthy_instances = replace_unhealthy_instances
  Jsii::Type.check_type(@replace_unhealthy_instances, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "replaceUnhealthyInstances") unless @replace_unhealthy_instances.nil?
  @spot_maintenance_strategies = spot_maintenance_strategies.is_a?(Hash) ? ::AWSCDK::EC2::CfnSpotFleet::SpotMaintenanceStrategiesProperty.new(**spot_maintenance_strategies.transform_keys(&:to_sym)) : spot_maintenance_strategies
  Jsii::Type.check_type(@spot_maintenance_strategies, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuU3BvdEZsZWV0LlNwb3RNYWludGVuYW5jZVN0cmF0ZWdpZXNQcm9wZXJ0eSJ9XX19")), "spotMaintenanceStrategies") unless @spot_maintenance_strategies.nil?
  @spot_max_total_price = spot_max_total_price
  Jsii::Type.check_type(@spot_max_total_price, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "spotMaxTotalPrice") unless @spot_max_total_price.nil?
  @spot_price = spot_price
  Jsii::Type.check_type(@spot_price, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "spotPrice") unless @spot_price.nil?
  @tag_specifications = tag_specifications
  Jsii::Type.check_type(@tag_specifications, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNmblNwb3RGbGVldC5TcG90RmxlZXRUYWdTcGVjaWZpY2F0aW9uUHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "tagSpecifications") unless @tag_specifications.nil?
  @target_capacity_unit_type = target_capacity_unit_type
  Jsii::Type.check_type(@target_capacity_unit_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "targetCapacityUnitType") unless @target_capacity_unit_type.nil?
  @terminate_instances_with_expiration = terminate_instances_with_expiration
  Jsii::Type.check_type(@terminate_instances_with_expiration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "terminateInstancesWithExpiration") unless @terminate_instances_with_expiration.nil?
  @type = type
  Jsii::Type.check_type(@type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "type") unless @type.nil?
  @valid_from = valid_from
  Jsii::Type.check_type(@valid_from, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "validFrom") unless @valid_from.nil?
  @valid_until = valid_until
  Jsii::Type.check_type(@valid_until, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "validUntil") unless @valid_until.nil?
end

Instance Attribute Details

#allocation_strategyString? (readonly)

The strategy that determines how to allocate the target Spot Instance capacity across the Spot Instance pools specified by the Spot Fleet launch configuration.

For more information, see Allocation strategies for Spot Instances in the Amazon EC2 User Guide .

  • priceCapacityOptimized (recommended) - Spot 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. Spot Fleet then requests Spot Instances from the lowest priced of these pools.
  • capacityOptimized - Spot 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 Spot Fleet uses a launch template. Note that if the OnDemandAllocationStrategy is set to prioritized , the same priority is applied when fulfilling On-Demand capacity.
  • diversified - Spot Fleet requests instances from all of the Spot Instance pools that you specify.
  • lowestPrice (not recommended) - > We don't recommend the lowest_price allocation strategy because it has the highest risk of interruption for your Spot Instances.

Spot 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, Spot 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



2729
2730
2731
# File 'ec2/cfn_spot_fleet.rb', line 2729

def allocation_strategy
  @allocation_strategy
end

#contextString? (readonly)

Reserved.



2734
2735
2736
# File 'ec2/cfn_spot_fleet.rb', line 2734

def context
  @context
end

#excess_capacity_termination_policyString? (readonly)

Indicates whether running Spot Instances should be terminated if you decrease the target capacity of the Spot Fleet request below the current size of the Spot Fleet.

Supported only for fleets of type maintain .



2741
2742
2743
# File 'ec2/cfn_spot_fleet.rb', line 2741

def excess_capacity_termination_policy
  @excess_capacity_termination_policy
end

#iam_fleet_roleString (readonly)

The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM) role that grants the Spot Fleet the permission to request, launch, terminate, and tag instances on your behalf.

For more information, see Spot Fleet Prerequisites in the Amazon EC2 User Guide . Spot Fleet can terminate Spot Instances on your behalf when you cancel its Spot Fleet request or when the Spot Fleet request expires, if you set TerminateInstancesWithExpiration .



2706
2707
2708
# File 'ec2/cfn_spot_fleet.rb', line 2706

def iam_fleet_role
  @iam_fleet_role
end

#instance_interruption_behaviorString? (readonly)

The behavior when a Spot Instance is interrupted.

The default is terminate .



2748
2749
2750
# File 'ec2/cfn_spot_fleet.rb', line 2748

def instance_interruption_behavior
  @instance_interruption_behavior
end

#instance_pools_to_use_countNumeric? (readonly)

The number of Spot pools across which to allocate your target Spot capacity.

Valid only when Spot AllocationStrategy is set to lowest-price . Spot Fleet selects the cheapest Spot pools and evenly allocates your target Spot capacity across the number of Spot pools that you specify.

Note that Spot 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, Spot 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.



2757
2758
2759
# File 'ec2/cfn_spot_fleet.rb', line 2757

def instance_pools_to_use_count
  @instance_pools_to_use_count
end

#launch_specificationsAWSCDK::IResolvable, ... (readonly)

The launch specifications for the Spot Fleet request.

If you specify LaunchSpecifications , you can't specify LaunchTemplateConfigs .



2764
2765
2766
# File 'ec2/cfn_spot_fleet.rb', line 2764

def launch_specifications
  @launch_specifications
end

#launch_template_configsAWSCDK::IResolvable, ... (readonly)

The launch template and overrides.

If you specify LaunchTemplateConfigs , you can't specify LaunchSpecifications .



2771
2772
2773
# File 'ec2/cfn_spot_fleet.rb', line 2771

def launch_template_configs
  @launch_template_configs
end

#load_balancers_configAWSCDK::IResolvable, ... (readonly)

One or more Classic Load Balancers and target groups to attach to the Spot Fleet request.

Spot Fleet registers the running Spot Instances with the specified Classic Load Balancers and target groups.

With Network Load Balancers, Spot Fleet cannot register instances that have the following instance types: C1, CC1, CC2, CG1, CG2, CR1, CS1, G1, G2, HI1, HS1, M1, M2, M3, and T1.



2780
2781
2782
# File 'ec2/cfn_spot_fleet.rb', line 2780

def load_balancers_config
  @load_balancers_config
end

#on_demand_allocation_strategyString? (readonly)

The order of the launch template overrides to use in fulfilling On-Demand capacity.

If you specify lowest_price , Spot Fleet uses price to determine the order, launching the lowest price first. If you specify prioritized , Spot Fleet uses the priority that you assign to each Spot Fleet launch template override, launching the highest priority first. If you do not specify a value, Spot Fleet defaults to lowest_price .



2787
2788
2789
# File 'ec2/cfn_spot_fleet.rb', line 2787

def on_demand_allocation_strategy
  @on_demand_allocation_strategy
end

#on_demand_max_total_priceString? (readonly)

The maximum amount per hour for On-Demand Instances that you're willing to pay.

You can use the on_demand_max_total_price parameter, the spot_max_total_price parameter, or both parameters to ensure that your fleet cost does not exceed your budget. If you set a maximum price per hour for the On-Demand Instances and Spot Instances in your request, Spot Fleet will launch instances until it reaches the maximum amount you're willing to pay. When the maximum amount you're willing to pay is reached, the fleet stops launching instances even if it hasn’t met the target capacity.

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. The on_demand_max_total_price does not account for surplus credits, and, if you use surplus credits, your final cost might be higher than what you specified for on_demand_max_total_price . For more information, see Surplus credits can incur charges in the Amazon EC2 User Guide .



2796
2797
2798
# File 'ec2/cfn_spot_fleet.rb', line 2796

def on_demand_max_total_price
  @on_demand_max_total_price
end

#on_demand_target_capacityNumeric? (readonly)

The number of On-Demand units to request.

You can choose to set the target capacity in terms of instances or a performance characteristic that is important to your application workload, such as vCPUs, memory, or I/O. If the request type is maintain , you can specify a target capacity of 0 and add capacity later.



2803
2804
2805
# File 'ec2/cfn_spot_fleet.rb', line 2803

def on_demand_target_capacity
  @on_demand_target_capacity
end

#replace_unhealthy_instancesBoolean, ... (readonly)

Indicates whether Spot Fleet should replace unhealthy instances.



2808
2809
2810
# File 'ec2/cfn_spot_fleet.rb', line 2808

def replace_unhealthy_instances
  @replace_unhealthy_instances
end

#spot_maintenance_strategiesAWSCDK::IResolvable, ... (readonly)

The strategies for managing your Spot Instances that are at an elevated risk of being interrupted.



2813
2814
2815
# File 'ec2/cfn_spot_fleet.rb', line 2813

def spot_maintenance_strategies
  @spot_maintenance_strategies
end

#spot_max_total_priceString? (readonly)

The maximum amount per hour for Spot Instances that you're willing to pay.

You can use the spot_max_total_price parameter, the on_demand_max_total_price parameter, or both parameters to ensure that your fleet cost does not exceed your budget. If you set a maximum price per hour for the On-Demand Instances and Spot Instances in your request, Spot Fleet will launch instances until it reaches the maximum amount you're willing to pay. When the maximum amount you're willing to pay is reached, the fleet stops launching instances even if it hasn’t met the target capacity.

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. The spot_max_total_price does not account for surplus credits, and, if you use surplus credits, your final cost might be higher than what you specified for spot_max_total_price . For more information, see Surplus credits can incur charges in the Amazon EC2 User Guide .



2822
2823
2824
# File 'ec2/cfn_spot_fleet.rb', line 2822

def spot_max_total_price
  @spot_max_total_price
end

#spot_priceString? (readonly)

The maximum price per unit hour that you are willing to pay for a Spot Instance.

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 instances will be interrupted more frequently than if you do not specify this parameter.



2831
2832
2833
# File 'ec2/cfn_spot_fleet.rb', line 2831

def spot_price
  @spot_price
end

#tag_specificationsAWSCDK::IResolvable, ... (readonly)

The key-value pair for tagging the Spot Fleet request on creation.

The value for ResourceType must be spot-fleet-request , otherwise the Spot Fleet request fails. To tag instances at launch, specify the tags in the launch template (valid only if you use LaunchTemplateConfigs ) or in the [SpotFleetTagSpecification](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_SpotFleetTagSpecification.html) (valid only if you use LaunchSpecifications ). For information about tagging after launch, see Tag your resources .



2838
2839
2840
# File 'ec2/cfn_spot_fleet.rb', line 2838

def tag_specifications
  @tag_specifications
end

#target_capacityNumeric (readonly)

The number of units to request for the Spot Fleet.

You can choose to set the target capacity in terms of instances or a performance characteristic that is important to your application workload, such as vCPUs, memory, or I/O. If the request type is maintain , you can specify a target capacity of 0 and add capacity later.



2713
2714
2715
# File 'ec2/cfn_spot_fleet.rb', line 2713

def target_capacity
  @target_capacity
end

#target_capacity_unit_typeString? (readonly)

The unit for the target capacity. You can specify this parameter only when using attribute-based instance type selection.

Default: units (the number of instances)



2845
2846
2847
# File 'ec2/cfn_spot_fleet.rb', line 2845

def target_capacity_unit_type
  @target_capacity_unit_type
end

#terminate_instances_with_expirationBoolean, ... (readonly)

Indicates whether running Spot Instances are terminated when the Spot Fleet request expires.



2850
2851
2852
# File 'ec2/cfn_spot_fleet.rb', line 2850

def terminate_instances_with_expiration
  @terminate_instances_with_expiration
end

#typeString? (readonly)

The type of request.

Indicates whether the Spot Fleet only requests the target capacity or also attempts to maintain it. When this value is request , the Spot Fleet only places the required requests. It does not attempt to replenish Spot Instances if capacity is diminished, nor does it submit requests in alternative Spot pools if capacity is not available. When this value is maintain , the Spot Fleet maintains the target capacity. The Spot Fleet places the required requests to meet capacity and automatically replenishes any interrupted instances. Default: maintain . instant is listed but is not used by Spot Fleet.



2857
2858
2859
# File 'ec2/cfn_spot_fleet.rb', line 2857

def type
  @type
end

#valid_fromString? (readonly)

The start date and time of the request, in UTC format ( YYYY - MM - DD T HH : MM : SS Z).

By default, Amazon EC2 starts fulfilling the request immediately.



2864
2865
2866
# File 'ec2/cfn_spot_fleet.rb', line 2864

def valid_from
  @valid_from
end

#valid_untilString? (readonly)

The end date and time of the request, in UTC format ( YYYY - MM - DD T HH : MM : SS Z).

After the end date and time, no new Spot Instance requests are placed or able to fulfill the request. If no value is specified, the Spot Fleet request remains until you cancel it.



2871
2872
2873
# File 'ec2/cfn_spot_fleet.rb', line 2871

def valid_until
  @valid_until
end

Class Method Details

.jsii_propertiesObject



2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
# File 'ec2/cfn_spot_fleet.rb', line 2873

def self.jsii_properties
  {
    :iam_fleet_role => "iamFleetRole",
    :target_capacity => "targetCapacity",
    :allocation_strategy => "allocationStrategy",
    :context => "context",
    :excess_capacity_termination_policy => "excessCapacityTerminationPolicy",
    :instance_interruption_behavior => "instanceInterruptionBehavior",
    :instance_pools_to_use_count => "instancePoolsToUseCount",
    :launch_specifications => "launchSpecifications",
    :launch_template_configs => "launchTemplateConfigs",
    :load_balancers_config => "loadBalancersConfig",
    :on_demand_allocation_strategy => "onDemandAllocationStrategy",
    :on_demand_max_total_price => "onDemandMaxTotalPrice",
    :on_demand_target_capacity => "onDemandTargetCapacity",
    :replace_unhealthy_instances => "replaceUnhealthyInstances",
    :spot_maintenance_strategies => "spotMaintenanceStrategies",
    :spot_max_total_price => "spotMaxTotalPrice",
    :spot_price => "spotPrice",
    :tag_specifications => "tagSpecifications",
    :target_capacity_unit_type => "targetCapacityUnitType",
    :terminate_instances_with_expiration => "terminateInstancesWithExpiration",
    :type => "type",
    :valid_from => "validFrom",
    :valid_until => "validUntil",
  }
end

Instance Method Details

#to_jsiiObject



2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
# File 'ec2/cfn_spot_fleet.rb', line 2901

def to_jsii
  result = {}
  result.merge!({
    "iamFleetRole" => @iam_fleet_role,
    "targetCapacity" => @target_capacity,
    "allocationStrategy" => @allocation_strategy,
    "context" => @context,
    "excessCapacityTerminationPolicy" => @excess_capacity_termination_policy,
    "instanceInterruptionBehavior" => @instance_interruption_behavior,
    "instancePoolsToUseCount" => @instance_pools_to_use_count,
    "launchSpecifications" => @launch_specifications,
    "launchTemplateConfigs" => @launch_template_configs,
    "loadBalancersConfig" => @load_balancers_config,
    "onDemandAllocationStrategy" => @on_demand_allocation_strategy,
    "onDemandMaxTotalPrice" => @on_demand_max_total_price,
    "onDemandTargetCapacity" => @on_demand_target_capacity,
    "replaceUnhealthyInstances" => @replace_unhealthy_instances,
    "spotMaintenanceStrategies" => @spot_maintenance_strategies,
    "spotMaxTotalPrice" => @spot_max_total_price,
    "spotPrice" => @spot_price,
    "tagSpecifications" => @tag_specifications,
    "targetCapacityUnitType" => @target_capacity_unit_type,
    "terminateInstancesWithExpiration" => @terminate_instances_with_expiration,
    "type" => @type,
    "validFrom" => @valid_from,
    "validUntil" => @valid_until,
  })
  result.compact
end