Class: AWSCDK::EC2::CfnEC2Fleet::CapacityRebalanceProperty

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

Overview

The Spot Instance replacement strategy to use when Amazon EC2 emits a rebalance notification signal that your Spot Instance is at an elevated risk of being interrupted.

For more information, see Capacity rebalancing in the Amazon EC2 User Guide .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(replacement_strategy: nil, termination_delay: nil) ⇒ CapacityRebalanceProperty

Returns a new instance of CapacityRebalanceProperty.

Parameters:

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

    The replacement strategy to use. Only available for fleets of type maintain .

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

    The amount of time (in seconds) that Amazon EC2 waits before terminating the old Spot Instance after launching a new replacement Spot Instance.



942
943
944
945
946
947
# File 'ec2/cfn_ec2_fleet.rb', line 942

def initialize(replacement_strategy: nil, termination_delay: nil)
  @replacement_strategy = replacement_strategy
  Jsii::Type.check_type(@replacement_strategy, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "replacementStrategy") unless @replacement_strategy.nil?
  @termination_delay = termination_delay
  Jsii::Type.check_type(@termination_delay, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "terminationDelay") unless @termination_delay.nil?
end

Instance Attribute Details

#replacement_strategyString? (readonly)

The replacement strategy to use. Only available for fleets of type maintain .

launch - EC2 Fleet launches a replacement Spot Instance when a rebalance notification is emitted for an existing Spot Instance in the fleet. EC2 Fleet does not terminate the instances that receive a rebalance notification. You can terminate the old instances, or you can leave them running. You are charged for all instances while they are running.

launch-before-terminate - EC2 Fleet launches a replacement Spot Instance when a rebalance notification is emitted for an existing Spot Instance in the fleet, and then, after a delay that you specify (in TerminationDelay ), terminates the instances that received a rebalance notification.



957
958
959
# File 'ec2/cfn_ec2_fleet.rb', line 957

def replacement_strategy
  @replacement_strategy
end

#termination_delayNumeric? (readonly)

The amount of time (in seconds) that Amazon EC2 waits before terminating the old Spot Instance after launching a new replacement Spot Instance.

Required when ReplacementStrategy is set to launch-before-terminate .

Not valid when ReplacementStrategy is set to launch .

Valid values: Minimum value of 120 seconds. Maximum value of 7200 seconds.



968
969
970
# File 'ec2/cfn_ec2_fleet.rb', line 968

def termination_delay
  @termination_delay
end

Class Method Details

.jsii_propertiesObject



970
971
972
973
974
975
# File 'ec2/cfn_ec2_fleet.rb', line 970

def self.jsii_properties
  {
    :replacement_strategy => "replacementStrategy",
    :termination_delay => "terminationDelay",
  }
end

Instance Method Details

#to_jsiiObject



977
978
979
980
981
982
983
984
# File 'ec2/cfn_ec2_fleet.rb', line 977

def to_jsii
  result = {}
  result.merge!({
    "replacementStrategy" => @replacement_strategy,
    "terminationDelay" => @termination_delay,
  })
  result.compact
end