Class: AWSCDK::EC2::CfnEC2FleetProps

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

Overview

Properties for defining a CfnEC2Fleet.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(launch_template_configs:, target_capacity_specification:, context: nil, excess_capacity_termination_policy: nil, on_demand_options: nil, replace_unhealthy_instances: nil, reserved_capacity_options: nil, spot_options: nil, tag_specifications: nil, terminate_instances_with_expiration: nil, type: nil, valid_from: nil, valid_until: nil) ⇒ CfnEC2FleetProps

Returns a new instance of CfnEC2FleetProps.

Parameters:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'ec2/cfn_ec2_fleet_props.rb', line 22

def initialize(launch_template_configs:, target_capacity_specification:, context: nil, excess_capacity_termination_policy: nil, on_demand_options: nil, replace_unhealthy_instances: nil, reserved_capacity_options: nil, spot_options: nil, tag_specifications: nil, terminate_instances_with_expiration: nil, type: nil, valid_from: nil, valid_until: nil)
  @launch_template_configs = launch_template_configs
  Jsii::Type.check_type(@launch_template_configs, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNmbkVDMkZsZWV0LkZsZWV0TGF1bmNoVGVtcGxhdGVDb25maWdSZXF1ZXN0UHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "launchTemplateConfigs")
  @target_capacity_specification = target_capacity_specification.is_a?(Hash) ? ::AWSCDK::EC2::CfnEC2Fleet::TargetCapacitySpecificationRequestProperty.new(**target_capacity_specification.transform_keys(&:to_sym)) : target_capacity_specification
  Jsii::Type.check_type(@target_capacity_specification, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuRUMyRmxlZXQuVGFyZ2V0Q2FwYWNpdHlTcGVjaWZpY2F0aW9uUmVxdWVzdFByb3BlcnR5In1dfX0=")), "targetCapacitySpecification")
  @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?
  @on_demand_options = on_demand_options.is_a?(Hash) ? ::AWSCDK::EC2::CfnEC2Fleet::OnDemandOptionsRequestProperty.new(**on_demand_options.transform_keys(&:to_sym)) : on_demand_options
  Jsii::Type.check_type(@on_demand_options, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuRUMyRmxlZXQuT25EZW1hbmRPcHRpb25zUmVxdWVzdFByb3BlcnR5In1dfX0=")), "onDemandOptions") unless @on_demand_options.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?
  @reserved_capacity_options = reserved_capacity_options.is_a?(Hash) ? ::AWSCDK::EC2::CfnEC2Fleet::ReservedCapacityOptionsRequestProperty.new(**reserved_capacity_options.transform_keys(&:to_sym)) : reserved_capacity_options
  Jsii::Type.check_type(@reserved_capacity_options, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuRUMyRmxlZXQuUmVzZXJ2ZWRDYXBhY2l0eU9wdGlvbnNSZXF1ZXN0UHJvcGVydHkifV19fQ==")), "reservedCapacityOptions") unless @reserved_capacity_options.nil?
  @spot_options = spot_options.is_a?(Hash) ? ::AWSCDK::EC2::CfnEC2Fleet::SpotOptionsRequestProperty.new(**spot_options.transform_keys(&:to_sym)) : spot_options
  Jsii::Type.check_type(@spot_options, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuRUMyRmxlZXQuU3BvdE9wdGlvbnNSZXF1ZXN0UHJvcGVydHkifV19fQ==")), "spotOptions") unless @spot_options.nil?
  @tag_specifications = tag_specifications
  Jsii::Type.check_type(@tag_specifications, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNmbkVDMkZsZWV0LlRhZ1NwZWNpZmljYXRpb25Qcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "tagSpecifications") unless @tag_specifications.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

#contextString? (readonly)

Reserved.



65
66
67
# File 'ec2/cfn_ec2_fleet_props.rb', line 65

def context
  @context
end

#excess_capacity_termination_policyString? (readonly)

Indicates whether running instances should be terminated if the total target capacity of the EC2 Fleet is decreased below the current size of the EC2 Fleet.

Supported only for fleets of type maintain .



72
73
74
# File 'ec2/cfn_ec2_fleet_props.rb', line 72

def excess_capacity_termination_policy
  @excess_capacity_termination_policy
end

#launch_template_configsAWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::EC2::CfnEC2Fleet::FleetLaunchTemplateConfigRequestProperty> (readonly)

The configuration for the EC2 Fleet.



55
56
57
# File 'ec2/cfn_ec2_fleet_props.rb', line 55

def launch_template_configs
  @launch_template_configs
end

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

Describes the configuration of On-Demand Instances in an EC2 Fleet.



77
78
79
# File 'ec2/cfn_ec2_fleet_props.rb', line 77

def on_demand_options
  @on_demand_options
end

#replace_unhealthy_instancesBoolean, ... (readonly)

Indicates whether EC2 Fleet should replace unhealthy Spot Instances.

Supported only for fleets of type maintain . For more information, see EC2 Fleet health checks in the Amazon EC2 User Guide .



84
85
86
# File 'ec2/cfn_ec2_fleet_props.rb', line 84

def replace_unhealthy_instances
  @replace_unhealthy_instances
end

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



87
88
89
# File 'ec2/cfn_ec2_fleet_props.rb', line 87

def reserved_capacity_options
  @reserved_capacity_options
end

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

Describes the configuration of Spot Instances in an EC2 Fleet.



92
93
94
# File 'ec2/cfn_ec2_fleet_props.rb', line 92

def spot_options
  @spot_options
end

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

The key-value pair for tagging the EC2 Fleet request on creation. For more information, see Tag your resources .

If the fleet type is instant , specify a resource type of fleet to tag the fleet or instance to tag the instances at launch.

If the fleet type is maintain or request , specify a resource type of fleet to tag the fleet. You cannot specify a resource type of instance . To tag instances at launch, specify the tags in a launch template .



101
102
103
# File 'ec2/cfn_ec2_fleet_props.rb', line 101

def tag_specifications
  @tag_specifications
end

#target_capacity_specificationAWSCDK::IResolvable, AWSCDK::EC2::CfnEC2Fleet::TargetCapacitySpecificationRequestProperty (readonly)

The number of units to request.



60
61
62
# File 'ec2/cfn_ec2_fleet_props.rb', line 60

def target_capacity_specification
  @target_capacity_specification
end

#terminate_instances_with_expirationBoolean, ... (readonly)

Indicates whether running instances should be terminated when the EC2 Fleet expires.



106
107
108
# File 'ec2/cfn_ec2_fleet_props.rb', line 106

def terminate_instances_with_expiration
  @terminate_instances_with_expiration
end

#typeString? (readonly)

The fleet type. The default value is maintain .

  • maintain - The EC2 Fleet places an asynchronous request for your desired capacity, and continues to maintain your desired Spot capacity by replenishing interrupted Spot Instances.
  • request - The EC2 Fleet places an asynchronous one-time request for your desired capacity, but does submit Spot requests in alternative capacity pools if Spot capacity is unavailable, and does not maintain Spot capacity if Spot Instances are interrupted.
  • instant - The EC2 Fleet places a synchronous one-time request for your desired capacity, and returns errors for any instances that could not be launched.

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



117
118
119
# File 'ec2/cfn_ec2_fleet_props.rb', line 117

def type
  @type
end

#valid_fromString? (readonly)

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

The default is to start fulfilling the request immediately.



124
125
126
# File 'ec2/cfn_ec2_fleet_props.rb', line 124

def valid_from
  @valid_from
end

#valid_untilString? (readonly)

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

At this point, no new EC2 Fleet requests are placed or able to fulfill the request. If no value is specified, the request remains until you cancel it.



131
132
133
# File 'ec2/cfn_ec2_fleet_props.rb', line 131

def valid_until
  @valid_until
end

Class Method Details

.jsii_propertiesObject



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'ec2/cfn_ec2_fleet_props.rb', line 133

def self.jsii_properties
  {
    :launch_template_configs => "launchTemplateConfigs",
    :target_capacity_specification => "targetCapacitySpecification",
    :context => "context",
    :excess_capacity_termination_policy => "excessCapacityTerminationPolicy",
    :on_demand_options => "onDemandOptions",
    :replace_unhealthy_instances => "replaceUnhealthyInstances",
    :reserved_capacity_options => "reservedCapacityOptions",
    :spot_options => "spotOptions",
    :tag_specifications => "tagSpecifications",
    :terminate_instances_with_expiration => "terminateInstancesWithExpiration",
    :type => "type",
    :valid_from => "validFrom",
    :valid_until => "validUntil",
  }
end

Instance Method Details

#to_jsiiObject



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'ec2/cfn_ec2_fleet_props.rb', line 151

def to_jsii
  result = {}
  result.merge!({
    "launchTemplateConfigs" => @launch_template_configs,
    "targetCapacitySpecification" => @target_capacity_specification,
    "context" => @context,
    "excessCapacityTerminationPolicy" => @excess_capacity_termination_policy,
    "onDemandOptions" => @on_demand_options,
    "replaceUnhealthyInstances" => @replace_unhealthy_instances,
    "reservedCapacityOptions" => @reserved_capacity_options,
    "spotOptions" => @spot_options,
    "tagSpecifications" => @tag_specifications,
    "terminateInstancesWithExpiration" => @terminate_instances_with_expiration,
    "type" => @type,
    "validFrom" => @valid_from,
    "validUntil" => @valid_until,
  })
  result.compact
end