Class: AWSCDK::EC2::CfnEC2Fleet::OnDemandOptionsRequestProperty

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

Overview

Specifies the allocation strategy of On-Demand Instances in an EC2 Fleet.

OnDemandOptionsRequest is a property of the AWS::EC2::EC2Fleet resource.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(allocation_strategy: nil, capacity_reservation_options: nil, max_total_price: nil, min_target_capacity: nil, single_availability_zone: nil, single_instance_type: nil) ⇒ OnDemandOptionsRequestProperty

Returns a new instance of OnDemandOptionsRequestProperty.

Parameters:

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

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

  • capacity_reservation_options (AWSCDK::IResolvable, AWSCDK::EC2::CfnEC2Fleet::CapacityReservationOptionsRequestProperty, nil) (defaults to: nil)

    The strategy for using unused Capacity Reservations for fulfilling On-Demand capacity.

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

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

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

    The minimum target capacity for On-Demand Instances in the fleet.

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

    Indicates that the fleet launches all On-Demand Instances into a single Availability Zone.

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

    Indicates that the fleet uses a single instance type to launch all On-Demand Instances in the fleet.



2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
# File 'ec2/cfn_ec2_fleet.rb', line 2462

def initialize(allocation_strategy: nil, capacity_reservation_options: 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?
  @capacity_reservation_options = capacity_reservation_options.is_a?(Hash) ? ::AWSCDK::EC2::CfnEC2Fleet::CapacityReservationOptionsRequestProperty.new(**capacity_reservation_options.transform_keys(&:to_sym)) : capacity_reservation_options
  Jsii::Type.check_type(@capacity_reservation_options, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuRUMyRmxlZXQuQ2FwYWNpdHlSZXNlcnZhdGlvbk9wdGlvbnNSZXF1ZXN0UHJvcGVydHkifV19fQ==")), "capacityReservationOptions") unless @capacity_reservation_options.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_strategyString? (readonly)

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

lowest-price - EC2 Fleet uses price to determine the order, launching the lowest price first.

prioritized - EC2 Fleet uses the priority that you assigned to each launch template override, launching the highest priority first.

Default: lowest-price



2487
2488
2489
# File 'ec2/cfn_ec2_fleet.rb', line 2487

def allocation_strategy
  @allocation_strategy
end

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

The strategy for using unused Capacity Reservations for fulfilling On-Demand capacity.

Supported only for fleets of type instant .



2494
2495
2496
# File 'ec2/cfn_ec2_fleet.rb', line 2494

def capacity_reservation_options
  @capacity_reservation_options
end

#max_total_priceString? (readonly)

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

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



2501
2502
2503
# File 'ec2/cfn_ec2_fleet.rb', line 2501

def max_total_price
  @max_total_price
end

#min_target_capacityNumeric? (readonly)

The minimum target capacity for On-Demand 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



2512
2513
2514
# File 'ec2/cfn_ec2_fleet.rb', line 2512

def min_target_capacity
  @min_target_capacity
end

#single_availability_zoneBoolean, ... (readonly)

Indicates that the fleet launches all On-Demand Instances into a single Availability Zone.

Supported only for fleets of type instant .



2519
2520
2521
# File 'ec2/cfn_ec2_fleet.rb', line 2519

def single_availability_zone
  @single_availability_zone
end

#single_instance_typeBoolean, ... (readonly)

Indicates that the fleet uses a single instance type to launch all On-Demand Instances in the fleet.

Supported only for fleets of type instant .



2526
2527
2528
# File 'ec2/cfn_ec2_fleet.rb', line 2526

def single_instance_type
  @single_instance_type
end

Class Method Details

.jsii_propertiesObject



2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
# File 'ec2/cfn_ec2_fleet.rb', line 2528

def self.jsii_properties
  {
    :allocation_strategy => "allocationStrategy",
    :capacity_reservation_options => "capacityReservationOptions",
    :max_total_price => "maxTotalPrice",
    :min_target_capacity => "minTargetCapacity",
    :single_availability_zone => "singleAvailabilityZone",
    :single_instance_type => "singleInstanceType",
  }
end

Instance Method Details

#to_jsiiObject



2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
# File 'ec2/cfn_ec2_fleet.rb', line 2539

def to_jsii
  result = {}
  result.merge!({
    "allocationStrategy" => @allocation_strategy,
    "capacityReservationOptions" => @capacity_reservation_options,
    "maxTotalPrice" => @max_total_price,
    "minTargetCapacity" => @min_target_capacity,
    "singleAvailabilityZone" => @single_availability_zone,
    "singleInstanceType" => @single_instance_type,
  })
  result.compact
end