Class: AWSCDK::EC2::CfnLaunchTemplate::SpotOptionsProperty

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

Overview

Specifies options for Spot Instances.

SpotOptions is a property of AWS::EC2::LaunchTemplate InstanceMarketOptions .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(block_duration_minutes: nil, instance_interruption_behavior: nil, max_price: nil, spot_instance_type: nil, valid_until: nil) ⇒ SpotOptionsProperty

Returns a new instance of SpotOptionsProperty.

Parameters:

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

    Deprecated.

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

    The behavior when a Spot Instance is interrupted.

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

    The maximum hourly price you're willing to pay for a Spot Instance.

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

    The Spot Instance request type.

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

    The end date of the request, in UTC format ( YYYY-MM-DD T HH:MM:SS Z). Supported only for persistent requests.



3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
# File 'ec2/cfn_launch_template.rb', line 3636

def initialize(block_duration_minutes: nil, instance_interruption_behavior: nil, max_price: nil, spot_instance_type: nil, valid_until: nil)
  @block_duration_minutes = block_duration_minutes
  Jsii::Type.check_type(@block_duration_minutes, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "blockDurationMinutes") unless @block_duration_minutes.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?
  @max_price = max_price
  Jsii::Type.check_type(@max_price, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "maxPrice") unless @max_price.nil?
  @spot_instance_type = spot_instance_type
  Jsii::Type.check_type(@spot_instance_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "spotInstanceType") unless @spot_instance_type.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

#block_duration_minutesNumeric? (readonly)

Deprecated.



3653
3654
3655
# File 'ec2/cfn_launch_template.rb', line 3653

def block_duration_minutes
  @block_duration_minutes
end

#instance_interruption_behaviorString? (readonly)

The behavior when a Spot Instance is interrupted.

The default is terminate .



3660
3661
3662
# File 'ec2/cfn_launch_template.rb', line 3660

def instance_interruption_behavior
  @instance_interruption_behavior
end

#max_priceString? (readonly)

The maximum hourly price you're 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 do specify this parameter, it must be more than USD $0.001. Specifying a value below USD $0.001 will result in an InvalidParameterValue error message when the launch template is used to launch an instance.

If you specify a maximum price, your Spot Instances will be interrupted more frequently than if you do not specify this parameter.



3669
3670
3671
# File 'ec2/cfn_launch_template.rb', line 3669

def max_price
  @max_price
end

#spot_instance_typeString? (readonly)

The Spot Instance request type.

If you are using Spot Instances with an Auto Scaling group, use one-time requests, as the Amazon EC2 Auto Scaling service handles requesting new Spot Instances whenever the group is below its desired capacity.



3676
3677
3678
# File 'ec2/cfn_launch_template.rb', line 3676

def spot_instance_type
  @spot_instance_type
end

#valid_untilString? (readonly)

The end date of the request, in UTC format ( YYYY-MM-DD T HH:MM:SS Z). Supported only for persistent requests.

  • For a persistent request, the request remains active until the ValidUntil date and time is reached. Otherwise, the request remains active until you cancel it.
  • For a one-time request, ValidUntil is not supported. The request remains active until all instances launch or you cancel the request.

Default: 7 days from the current date



3686
3687
3688
# File 'ec2/cfn_launch_template.rb', line 3686

def valid_until
  @valid_until
end

Class Method Details

.jsii_propertiesObject



3688
3689
3690
3691
3692
3693
3694
3695
3696
# File 'ec2/cfn_launch_template.rb', line 3688

def self.jsii_properties
  {
    :block_duration_minutes => "blockDurationMinutes",
    :instance_interruption_behavior => "instanceInterruptionBehavior",
    :max_price => "maxPrice",
    :spot_instance_type => "spotInstanceType",
    :valid_until => "validUntil",
  }
end

Instance Method Details

#to_jsiiObject



3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
# File 'ec2/cfn_launch_template.rb', line 3698

def to_jsii
  result = {}
  result.merge!({
    "blockDurationMinutes" => @block_duration_minutes,
    "instanceInterruptionBehavior" => @instance_interruption_behavior,
    "maxPrice" => @max_price,
    "spotInstanceType" => @spot_instance_type,
    "validUntil" => @valid_until,
  })
  result.compact
end