Class: AWSCDK::EC2::CfnSpotFleet::SpotFleetLaunchSpecificationProperty

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

Overview

Specifies the launch specification for one or more Spot Instances.

If you include On-Demand capacity in your fleet request, you can't use SpotFleetLaunchSpecification ; you must use LaunchTemplateConfig .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(image_id:, block_device_mappings: nil, ebs_optimized: nil, iam_instance_profile: nil, instance_requirements: nil, instance_type: nil, kernel_id: nil, key_name: nil, monitoring: nil, network_interfaces: nil, placement: nil, ramdisk_id: nil, security_groups: nil, spot_price: nil, subnet_id: nil, tag_specifications: nil, user_data: nil, weighted_capacity: nil) ⇒ SpotFleetLaunchSpecificationProperty

Returns a new instance of SpotFleetLaunchSpecificationProperty.

Parameters:



2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
# File 'ec2/cfn_spot_fleet.rb', line 2372

def initialize(image_id:, block_device_mappings: nil, ebs_optimized: nil, iam_instance_profile: nil, instance_requirements: nil, instance_type: nil, kernel_id: nil, key_name: nil, monitoring: nil, network_interfaces: nil, placement: nil, ramdisk_id: nil, security_groups: nil, spot_price: nil, subnet_id: nil, tag_specifications: nil, user_data: nil, weighted_capacity: nil)
  @image_id = image_id
  Jsii::Type.check_type(@image_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "imageId")
  @block_device_mappings = block_device_mappings
  Jsii::Type.check_type(@block_device_mappings, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNmblNwb3RGbGVldC5CbG9ja0RldmljZU1hcHBpbmdQcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "blockDeviceMappings") unless @block_device_mappings.nil?
  @ebs_optimized = ebs_optimized
  Jsii::Type.check_type(@ebs_optimized, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "ebsOptimized") unless @ebs_optimized.nil?
  @iam_instance_profile = iam_instance_profile.is_a?(Hash) ? ::AWSCDK::EC2::CfnSpotFleet::IAMInstanceProfileSpecificationProperty.new(**iam_instance_profile.transform_keys(&:to_sym)) : iam_instance_profile
  Jsii::Type.check_type(@iam_instance_profile, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuU3BvdEZsZWV0LklhbUluc3RhbmNlUHJvZmlsZVNwZWNpZmljYXRpb25Qcm9wZXJ0eSJ9XX19")), "iamInstanceProfile") unless @iam_instance_profile.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?
  @kernel_id = kernel_id
  Jsii::Type.check_type(@kernel_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "kernelId") unless @kernel_id.nil?
  @key_name = key_name
  Jsii::Type.check_type(@key_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "keyName") unless @key_name.nil?
  @monitoring = monitoring.is_a?(Hash) ? ::AWSCDK::EC2::CfnSpotFleet::SpotFleetMonitoringProperty.new(**monitoring.transform_keys(&:to_sym)) : monitoring
  Jsii::Type.check_type(@monitoring, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuU3BvdEZsZWV0LlNwb3RGbGVldE1vbml0b3JpbmdQcm9wZXJ0eSJ9XX19")), "monitoring") unless @monitoring.nil?
  @network_interfaces = network_interfaces
  Jsii::Type.check_type(@network_interfaces, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNmblNwb3RGbGVldC5JbnN0YW5jZU5ldHdvcmtJbnRlcmZhY2VTcGVjaWZpY2F0aW9uUHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "networkInterfaces") unless @network_interfaces.nil?
  @placement = placement.is_a?(Hash) ? ::AWSCDK::EC2::CfnSpotFleet::SpotPlacementProperty.new(**placement.transform_keys(&:to_sym)) : placement
  Jsii::Type.check_type(@placement, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuU3BvdEZsZWV0LlNwb3RQbGFjZW1lbnRQcm9wZXJ0eSJ9XX19")), "placement") unless @placement.nil?
  @ramdisk_id = ramdisk_id
  Jsii::Type.check_type(@ramdisk_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "ramdiskId") unless @ramdisk_id.nil?
  @security_groups = security_groups
  Jsii::Type.check_type(@security_groups, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNmblNwb3RGbGVldC5Hcm91cElkZW50aWZpZXJQcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "securityGroups") unless @security_groups.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?
  @tag_specifications = tag_specifications
  Jsii::Type.check_type(@tag_specifications, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNmblNwb3RGbGVldC5TcG90RmxlZXRUYWdTcGVjaWZpY2F0aW9uUHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "tagSpecifications") unless @tag_specifications.nil?
  @user_data = user_data
  Jsii::Type.check_type(@user_data, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "userData") unless @user_data.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

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

One or more block devices that are mapped to the Spot Instances.

You can't specify both a snapshot ID and an encryption value. This is because only blank volumes can be encrypted on creation. If a snapshot is the basis for a volume, it is not blank and its encryption status is used for the volume encryption status.



2422
2423
2424
# File 'ec2/cfn_spot_fleet.rb', line 2422

def block_device_mappings
  @block_device_mappings
end

#ebs_optimizedBoolean, ... (readonly)

Note:

Default: - false

Indicates whether the instances are optimized for EBS I/O.

This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal EBS I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS Optimized instance.

Default: false



2432
2433
2434
# File 'ec2/cfn_spot_fleet.rb', line 2432

def ebs_optimized
  @ebs_optimized
end

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

The IAM instance profile.



2437
2438
2439
# File 'ec2/cfn_spot_fleet.rb', line 2437

def iam_instance_profile
  @iam_instance_profile
end

#image_idString (readonly)

The ID of the AMI.



2415
2416
2417
# File 'ec2/cfn_spot_fleet.rb', line 2415

def image_id
  @image_id
end

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

The attributes for the instance types.

When you specify instance attributes, Amazon EC2 will identify instance types with those attributes.

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



2446
2447
2448
# File 'ec2/cfn_spot_fleet.rb', line 2446

def instance_requirements
  @instance_requirements
end

#instance_typeString? (readonly)

The instance type.



2451
2452
2453
# File 'ec2/cfn_spot_fleet.rb', line 2451

def instance_type
  @instance_type
end

#kernel_idString? (readonly)

The ID of the kernel.



2456
2457
2458
# File 'ec2/cfn_spot_fleet.rb', line 2456

def kernel_id
  @kernel_id
end

#key_nameString? (readonly)

The name of the key pair.



2461
2462
2463
# File 'ec2/cfn_spot_fleet.rb', line 2461

def key_name
  @key_name
end

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

Enable or disable monitoring for the instances.



2466
2467
2468
# File 'ec2/cfn_spot_fleet.rb', line 2466

def monitoring
  @monitoring
end

#ramdisk_idString? (readonly)

The ID of the RAM disk.

Some kernels require additional drivers at launch. Check the kernel requirements for information about whether you need to specify a RAM disk. To find kernel requirements, refer to the AWS Resource Center and search for the kernel ID.



2483
2484
2485
# File 'ec2/cfn_spot_fleet.rb', line 2483

def ramdisk_id
  @ramdisk_id
end

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

The security groups.

If you specify a network interface, you must specify any security groups as part of the network interface instead of using this parameter.



2490
2491
2492
# File 'ec2/cfn_spot_fleet.rb', line 2490

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



2499
2500
2501
# File 'ec2/cfn_spot_fleet.rb', line 2499

def spot_price
  @spot_price
end

#subnet_idString? (readonly)

The IDs of the subnets in which to launch the instances.

To specify multiple subnets, separate them using commas; for example, "subnet-1234abcdeexample1, subnet-0987cdef6example2".

If you specify a network interface, you must specify any subnets as part of the network interface instead of using this parameter.



2508
2509
2510
# File 'ec2/cfn_spot_fleet.rb', line 2508

def subnet_id
  @subnet_id
end

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

The tags to apply during creation.



2513
2514
2515
# File 'ec2/cfn_spot_fleet.rb', line 2513

def tag_specifications
  @tag_specifications
end

#user_dataString? (readonly)

The base64-encoded user data that instances use when starting up.

User data is limited to 16 KB.



2520
2521
2522
# File 'ec2/cfn_spot_fleet.rb', line 2520

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



2531
2532
2533
# File 'ec2/cfn_spot_fleet.rb', line 2531

def weighted_capacity
  @weighted_capacity
end

Class Method Details

.jsii_propertiesObject



2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
# File 'ec2/cfn_spot_fleet.rb', line 2533

def self.jsii_properties
  {
    :image_id => "imageId",
    :block_device_mappings => "blockDeviceMappings",
    :ebs_optimized => "ebsOptimized",
    :iam_instance_profile => "iamInstanceProfile",
    :instance_requirements => "instanceRequirements",
    :instance_type => "instanceType",
    :kernel_id => "kernelId",
    :key_name => "keyName",
    :monitoring => "monitoring",
    :network_interfaces => "networkInterfaces",
    :placement => "placement",
    :ramdisk_id => "ramdiskId",
    :security_groups => "securityGroups",
    :spot_price => "spotPrice",
    :subnet_id => "subnetId",
    :tag_specifications => "tagSpecifications",
    :user_data => "userData",
    :weighted_capacity => "weightedCapacity",
  }
end

Instance Method Details

#to_jsiiObject



2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
# File 'ec2/cfn_spot_fleet.rb', line 2556

def to_jsii
  result = {}
  result.merge!({
    "imageId" => @image_id,
    "blockDeviceMappings" => @block_device_mappings,
    "ebsOptimized" => @ebs_optimized,
    "iamInstanceProfile" => @iam_instance_profile,
    "instanceRequirements" => @instance_requirements,
    "instanceType" => @instance_type,
    "kernelId" => @kernel_id,
    "keyName" => @key_name,
    "monitoring" => @monitoring,
    "networkInterfaces" => @network_interfaces,
    "placement" => @placement,
    "ramdiskId" => @ramdisk_id,
    "securityGroups" => @security_groups,
    "spotPrice" => @spot_price,
    "subnetId" => @subnet_id,
    "tagSpecifications" => @tag_specifications,
    "userData" => @user_data,
    "weightedCapacity" => @weighted_capacity,
  })
  result.compact
end