CfnEC2FleetProps

class aws_cdk.aws_ec2.CfnEC2FleetProps(*, launch_template_configs, target_capacity_specification, context=None, excess_capacity_termination_policy=None, on_demand_options=None, replace_unhealthy_instances=None, spot_options=None, tag_specifications=None, terminate_instances_with_expiration=None, type=None, valid_from=None, valid_until=None)

Bases: object

Properties for defining a CfnEC2Fleet.

Parameters
  • launch_template_configs (Union[IResolvable, Sequence[Union[IResolvable, FleetLaunchTemplateConfigRequestProperty]]]) – The configuration for the EC2 Fleet.

  • target_capacity_specification (Union[IResolvable, TargetCapacitySpecificationRequestProperty]) – The number of units to request.

  • context (Optional[str]) – Reserved.

  • excess_capacity_termination_policy (Optional[str]) – 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.

  • on_demand_options (Union[IResolvable, OnDemandOptionsRequestProperty, None]) – Describes the configuration of On-Demand Instances in an EC2 Fleet.

  • replace_unhealthy_instances (Union[bool, IResolvable, None]) – 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 .

  • spot_options (Union[IResolvable, SpotOptionsRequestProperty, None]) – Describes the configuration of Spot Instances in an EC2 Fleet.

  • tag_specifications (Union[IResolvable, Sequence[Union[IResolvable, TagSpecificationProperty]], None]) – The key-value pair for tagging the EC2 Fleet request on creation. For more information, see Tagging 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 .

  • terminate_instances_with_expiration (Union[bool, IResolvable, None]) – Indicates whether running instances should be terminated when the EC2 Fleet expires.

  • type (Optional[str]) – 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 .

  • valid_from (Optional[str]) – 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.

  • valid_until (Optional[str]) – 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.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ec2 as ec2

cfn_eC2_fleet_props = ec2.CfnEC2FleetProps(
    launch_template_configs=[ec2.CfnEC2Fleet.FleetLaunchTemplateConfigRequestProperty(
        launch_template_specification=ec2.CfnEC2Fleet.FleetLaunchTemplateSpecificationRequestProperty(
            launch_template_id="launchTemplateId",
            launch_template_name="launchTemplateName",
            version="version"
        ),
        overrides=[ec2.CfnEC2Fleet.FleetLaunchTemplateOverridesRequestProperty(
            availability_zone="availabilityZone",
            instance_requirements=ec2.CfnEC2Fleet.InstanceRequirementsRequestProperty(
                accelerator_count=ec2.CfnEC2Fleet.AcceleratorCountRequestProperty(
                    max=123,
                    min=123
                ),
                accelerator_manufacturers=["acceleratorManufacturers"],
                accelerator_names=["acceleratorNames"],
                accelerator_total_memory_mi_b=ec2.CfnEC2Fleet.AcceleratorTotalMemoryMiBRequestProperty(
                    max=123,
                    min=123
                ),
                accelerator_types=["acceleratorTypes"],
                bare_metal="bareMetal",
                baseline_ebs_bandwidth_mbps=ec2.CfnEC2Fleet.BaselineEbsBandwidthMbpsRequestProperty(
                    max=123,
                    min=123
                ),
                burstable_performance="burstablePerformance",
                cpu_manufacturers=["cpuManufacturers"],
                excluded_instance_types=["excludedInstanceTypes"],
                instance_generations=["instanceGenerations"],
                local_storage="localStorage",
                local_storage_types=["localStorageTypes"],
                memory_gi_bPer_vCpu=ec2.CfnEC2Fleet.MemoryGiBPerVCpuRequestProperty(
                    max=123,
                    min=123
                ),
                memory_mi_b=ec2.CfnEC2Fleet.MemoryMiBRequestProperty(
                    max=123,
                    min=123
                ),
                network_interface_count=ec2.CfnEC2Fleet.NetworkInterfaceCountRequestProperty(
                    max=123,
                    min=123
                ),
                on_demand_max_price_percentage_over_lowest_price=123,
                require_hibernate_support=False,
                spot_max_price_percentage_over_lowest_price=123,
                total_local_storage_gb=ec2.CfnEC2Fleet.TotalLocalStorageGBRequestProperty(
                    max=123,
                    min=123
                ),
                v_cpu_count=ec2.CfnEC2Fleet.VCpuCountRangeRequestProperty(
                    max=123,
                    min=123
                )
            ),
            instance_type="instanceType",
            max_price="maxPrice",
            placement=ec2.CfnEC2Fleet.PlacementProperty(
                affinity="affinity",
                availability_zone="availabilityZone",
                group_name="groupName",
                host_id="hostId",
                host_resource_group_arn="hostResourceGroupArn",
                partition_number=123,
                spread_domain="spreadDomain",
                tenancy="tenancy"
            ),
            priority=123,
            subnet_id="subnetId",
            weighted_capacity=123
        )]
    )],
    target_capacity_specification=ec2.CfnEC2Fleet.TargetCapacitySpecificationRequestProperty(
        total_target_capacity=123,

        # the properties below are optional
        default_target_capacity_type="defaultTargetCapacityType",
        on_demand_target_capacity=123,
        spot_target_capacity=123,
        target_capacity_unit_type="targetCapacityUnitType"
    ),

    # the properties below are optional
    context="context",
    excess_capacity_termination_policy="excessCapacityTerminationPolicy",
    on_demand_options=ec2.CfnEC2Fleet.OnDemandOptionsRequestProperty(
        allocation_strategy="allocationStrategy",
        capacity_reservation_options=ec2.CfnEC2Fleet.CapacityReservationOptionsRequestProperty(
            usage_strategy="usageStrategy"
        ),
        max_total_price="maxTotalPrice",
        min_target_capacity=123,
        single_availability_zone=False,
        single_instance_type=False
    ),
    replace_unhealthy_instances=False,
    spot_options=ec2.CfnEC2Fleet.SpotOptionsRequestProperty(
        allocation_strategy="allocationStrategy",
        instance_interruption_behavior="instanceInterruptionBehavior",
        instance_pools_to_use_count=123,
        maintenance_strategies=ec2.CfnEC2Fleet.MaintenanceStrategiesProperty(
            capacity_rebalance=ec2.CfnEC2Fleet.CapacityRebalanceProperty(
                replacement_strategy="replacementStrategy",
                termination_delay=123
            )
        ),
        max_total_price="maxTotalPrice",
        min_target_capacity=123,
        single_availability_zone=False,
        single_instance_type=False
    ),
    tag_specifications=[ec2.CfnEC2Fleet.TagSpecificationProperty(
        resource_type="resourceType",
        tags=[CfnTag(
            key="key",
            value="value"
        )]
    )],
    terminate_instances_with_expiration=False,
    type="type",
    valid_from="validFrom",
    valid_until="validUntil"
)

Attributes

context

Reserved.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-context

Return type

Optional[str]

excess_capacity_termination_policy

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.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-excesscapacityterminationpolicy

Return type

Optional[str]

launch_template_configs

The configuration for the EC2 Fleet.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-launchtemplateconfigs

Return type

Union[IResolvable, List[Union[IResolvable, FleetLaunchTemplateConfigRequestProperty]]]

on_demand_options

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

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-ondemandoptions

Return type

Union[IResolvable, OnDemandOptionsRequestProperty, None]

replace_unhealthy_instances

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 .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-replaceunhealthyinstances

Return type

Union[bool, IResolvable, None]

spot_options

Describes the configuration of Spot Instances in an EC2 Fleet.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-spotoptions

Return type

Union[IResolvable, SpotOptionsRequestProperty, None]

tag_specifications

//docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html#tag-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 .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-tagspecifications

Type

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

Return type

Union[IResolvable, List[Union[IResolvable, TagSpecificationProperty]], None]

target_capacity_specification

The number of units to request.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-targetcapacityspecification

Return type

Union[IResolvable, TargetCapacitySpecificationRequestProperty]

terminate_instances_with_expiration

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

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-terminateinstanceswithexpiration

Return type

Union[bool, IResolvable, None]

type

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 .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-type

Return type

Optional[str]

valid_from

SS Z).

The default is to start fulfilling the request immediately.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-validfrom

Type

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

Type

MM

Return type

Optional[str]

valid_until

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.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-validuntil

Type

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

Type

MM

Return type

Optional[str]