Class: AWSCDK::EC2::CfnSpotFleet::LaunchTemplateOverridesProperty

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

Overview

Specifies overrides for a launch template.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(availability_zone: nil, availability_zone_id: nil, instance_requirements: nil, instance_type: nil, priority: nil, spot_price: nil, subnet_id: nil, weighted_capacity: nil) ⇒ LaunchTemplateOverridesProperty

Returns a new instance of LaunchTemplateOverridesProperty.

Parameters:

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

    The Availability Zone in which to launch the instances. For example, us-east-2a .

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

    The ID of the Availability Zone in which to launch the instances. For example, use2-az1 .

  • instance_requirements (AWSCDK::IResolvable, AWSCDK::EC2::CfnSpotFleet::InstanceRequirementsRequestProperty, nil) (defaults to: nil)

    The instance requirements.

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

    The instance type.

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

    The priority for the launch template override. The highest priority is launched first.

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

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

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

    The ID of the subnet in which to launch the instances.

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

    The number of units provided by the specified instance type.



1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
# File 'ec2/cfn_spot_fleet.rb', line 1844

def initialize(availability_zone: nil, availability_zone_id: nil, instance_requirements: nil, instance_type: nil, priority: nil, spot_price: nil, subnet_id: nil, weighted_capacity: nil)
  @availability_zone = availability_zone
  Jsii::Type.check_type(@availability_zone, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "availabilityZone") unless @availability_zone.nil?
  @availability_zone_id = availability_zone_id
  Jsii::Type.check_type(@availability_zone_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "availabilityZoneId") unless @availability_zone_id.nil?
  @instance_requirements = instance_requirements.is_a?(Hash) ? ::AWSCDK::EC2::CfnSpotFleet::InstanceRequirementsRequestProperty.new(**instance_requirements.transform_keys(&:to_sym)) : instance_requirements
  Jsii::Type.check_type(@instance_requirements, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuU3BvdEZsZWV0Lkluc3RhbmNlUmVxdWlyZW1lbnRzUmVxdWVzdFByb3BlcnR5In1dfX0=")), "instanceRequirements") unless @instance_requirements.nil?
  @instance_type = instance_type
  Jsii::Type.check_type(@instance_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "instanceType") unless @instance_type.nil?
  @priority = priority
  Jsii::Type.check_type(@priority, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "priority") unless @priority.nil?
  @spot_price = spot_price
  Jsii::Type.check_type(@spot_price, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "spotPrice") unless @spot_price.nil?
  @subnet_id = subnet_id
  Jsii::Type.check_type(@subnet_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "subnetId") unless @subnet_id.nil?
  @weighted_capacity = weighted_capacity
  Jsii::Type.check_type(@weighted_capacity, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "weightedCapacity") unless @weighted_capacity.nil?
end

Instance Attribute Details

#availability_zoneString? (readonly)

The Availability Zone in which to launch the instances. For example, us-east-2a .

Either AvailabilityZone or AvailabilityZoneId must be specified in the request, but not both.



1869
1870
1871
# File 'ec2/cfn_spot_fleet.rb', line 1869

def availability_zone
  @availability_zone
end

#availability_zone_idString? (readonly)

The ID of the Availability Zone in which to launch the instances. For example, use2-az1 .

Either AvailabilityZone or AvailabilityZoneId must be specified in the request, but not both.



1876
1877
1878
# File 'ec2/cfn_spot_fleet.rb', line 1876

def availability_zone_id
  @availability_zone_id
end

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

The instance requirements.

When you specify instance requirements, Amazon EC2 will identify instance types with the provided requirements, and then use your On-Demand and Spot allocation strategies to launch instances from these instance types, in the same way as when you specify a list of instance types.

If you specify InstanceRequirements , you can't specify InstanceType .



1885
1886
1887
# File 'ec2/cfn_spot_fleet.rb', line 1885

def instance_requirements
  @instance_requirements
end

#instance_typeString? (readonly)

The instance type.



1890
1891
1892
# File 'ec2/cfn_spot_fleet.rb', line 1890

def instance_type
  @instance_type
end

#priorityNumeric? (readonly)

The priority for the launch template override. The highest priority is launched first.

If OnDemandAllocationStrategy is set to prioritized , Spot Fleet uses priority to determine which launch template override to use first in fulfilling On-Demand capacity.

If the Spot AllocationStrategy is set to capacity_optimized_prioritized , Spot Fleet uses priority on a best-effort basis to determine which launch template override to use in fulfilling Spot capacity, but optimizes for capacity first.

Valid values are whole numbers starting at 0 . The lower the number, the higher the priority. If no number is set, the launch template override has the lowest priority. You can set the same priority for different launch template overrides.



1901
1902
1903
# File 'ec2/cfn_spot_fleet.rb', line 1901

def priority
  @priority
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.



1910
1911
1912
# File 'ec2/cfn_spot_fleet.rb', line 1910

def spot_price
  @spot_price
end

#subnet_idString? (readonly)

The ID of the subnet in which to launch the instances.



1915
1916
1917
# File 'ec2/cfn_spot_fleet.rb', line 1915

def subnet_id
  @subnet_id
end

#weighted_capacityNumeric? (readonly)

The number of units provided by the specified instance type.

These are the same units that you chose to set the target capacity in terms of instances, or a performance characteristic such as vCPUs, memory, or I/O.

If the target capacity divided by this value is not a whole number, Amazon EC2 rounds the number of instances to the next whole number. If this value is not specified, the default is 1.

When specifying weights, the price used in the lowest_price and price_capacity_optimized allocation strategies is per unit hour (where the instance price is divided by the specified weight). However, if all the specified weights are above the requested TargetCapacity , resulting in only 1 instance being launched, the price used is per instance hour.



1926
1927
1928
# File 'ec2/cfn_spot_fleet.rb', line 1926

def weighted_capacity
  @weighted_capacity
end

Class Method Details

.jsii_propertiesObject



1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
# File 'ec2/cfn_spot_fleet.rb', line 1928

def self.jsii_properties
  {
    :availability_zone => "availabilityZone",
    :availability_zone_id => "availabilityZoneId",
    :instance_requirements => "instanceRequirements",
    :instance_type => "instanceType",
    :priority => "priority",
    :spot_price => "spotPrice",
    :subnet_id => "subnetId",
    :weighted_capacity => "weightedCapacity",
  }
end

Instance Method Details

#to_jsiiObject



1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
# File 'ec2/cfn_spot_fleet.rb', line 1941

def to_jsii
  result = {}
  result.merge!({
    "availabilityZone" => @availability_zone,
    "availabilityZoneId" => @availability_zone_id,
    "instanceRequirements" => @instance_requirements,
    "instanceType" => @instance_type,
    "priority" => @priority,
    "spotPrice" => @spot_price,
    "subnetId" => @subnet_id,
    "weightedCapacity" => @weighted_capacity,
  })
  result.compact
end