Fleet

Provides a resource to manage EC2 Fleets.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var example = new Aws.Ec2.Fleet("example", new Aws.Ec2.FleetArgs
        {
            LaunchTemplateConfig = new Aws.Ec2.Inputs.FleetLaunchTemplateConfigArgs
            {
                LaunchTemplateSpecification = new Aws.Ec2.Inputs.FleetLaunchTemplateConfigLaunchTemplateSpecificationArgs
                {
                    LaunchTemplateId = aws_launch_template.Example.Id,
                    Version = aws_launch_template.Example.Latest_version,
                },
            },
            TargetCapacitySpecification = new Aws.Ec2.Inputs.FleetTargetCapacitySpecificationArgs
            {
                DefaultTargetCapacityType = "spot",
                TotalTargetCapacity = 5,
            },
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ec2"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := ec2.NewFleet(ctx, "example", &ec2.FleetArgs{
            LaunchTemplateConfig: &ec2.FleetLaunchTemplateConfigArgs{
                LaunchTemplateSpecification: &ec2.FleetLaunchTemplateConfigLaunchTemplateSpecificationArgs{
                    LaunchTemplateId: pulumi.String(aws_launch_template.Example.Id),
                    Version:          pulumi.String(aws_launch_template.Example.Latest_version),
                },
            },
            TargetCapacitySpecification: &ec2.FleetTargetCapacitySpecificationArgs{
                DefaultTargetCapacityType: pulumi.String("spot"),
                TotalTargetCapacity:       pulumi.Int(5),
            },
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

example = aws.ec2.Fleet("example",
    launch_template_config={
        "launchTemplateSpecification": {
            "launchTemplateId": aws_launch_template["example"]["id"],
            "version": aws_launch_template["example"]["latest_version"],
        },
    },
    target_capacity_specification={
        "defaultTargetCapacityType": "spot",
        "totalTargetCapacity": 5,
    })
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.ec2.Fleet("example", {
    launchTemplateConfig: {
        launchTemplateSpecification: {
            launchTemplateId: aws_launch_template_example.id,
            version: aws_launch_template_example.latestVersion,
        },
    },
    targetCapacitySpecification: {
        defaultTargetCapacityType: "spot",
        totalTargetCapacity: 5,
    },
});

Create a Fleet Resource

new Fleet(name: string, args: FleetArgs, opts?: CustomResourceOptions);
def Fleet(resource_name, opts=None, excess_capacity_termination_policy=None, launch_template_config=None, on_demand_options=None, replace_unhealthy_instances=None, spot_options=None, tags=None, target_capacity_specification=None, terminate_instances=None, terminate_instances_with_expiration=None, type=None, __props__=None);
func NewFleet(ctx *Context, name string, args FleetArgs, opts ...ResourceOption) (*Fleet, error)
public Fleet(string name, FleetArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args FleetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args FleetArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args FleetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Fleet Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The Fleet resource accepts the following input properties:

LaunchTemplateConfig FleetLaunchTemplateConfigArgs

Nested argument containing EC2 Launch Template configurations. Defined below.

TargetCapacitySpecification FleetTargetCapacitySpecificationArgs

Nested argument containing target capacity configurations. Defined below.

ExcessCapacityTerminationPolicy string

Whether running instances should be terminated if the total target capacity of the EC2 Fleet is decreased below the current size of the EC2. Valid values: no-termination, termination. Defaults to termination.

OnDemandOptions FleetOnDemandOptionsArgs

Nested argument containing On-Demand configurations. Defined below.

ReplaceUnhealthyInstances bool

Whether EC2 Fleet should replace unhealthy instances. Defaults to false.

SpotOptions FleetSpotOptionsArgs

Nested argument containing Spot configurations. Defined below.

Tags Dictionary<string, string>

Map of Fleet tags. To tag instances at launch, specify the tags in the Launch Template.

TerminateInstances bool

Whether to terminate instances for an EC2 Fleet if it is deleted successfully. Defaults to false.

TerminateInstancesWithExpiration bool

Whether running instances should be terminated when the EC2 Fleet expires. Defaults to false.

Type string

The type of request. Indicates whether the EC2 Fleet only requests the target capacity, or also attempts to maintain it. Valid values: maintain, request. Defaults to maintain.

LaunchTemplateConfig FleetLaunchTemplateConfig

Nested argument containing EC2 Launch Template configurations. Defined below.

TargetCapacitySpecification FleetTargetCapacitySpecification

Nested argument containing target capacity configurations. Defined below.

ExcessCapacityTerminationPolicy string

Whether running instances should be terminated if the total target capacity of the EC2 Fleet is decreased below the current size of the EC2. Valid values: no-termination, termination. Defaults to termination.

OnDemandOptions FleetOnDemandOptions

Nested argument containing On-Demand configurations. Defined below.

ReplaceUnhealthyInstances bool

Whether EC2 Fleet should replace unhealthy instances. Defaults to false.

SpotOptions FleetSpotOptions

Nested argument containing Spot configurations. Defined below.

Tags map[string]string

Map of Fleet tags. To tag instances at launch, specify the tags in the Launch Template.

TerminateInstances bool

Whether to terminate instances for an EC2 Fleet if it is deleted successfully. Defaults to false.

TerminateInstancesWithExpiration bool

Whether running instances should be terminated when the EC2 Fleet expires. Defaults to false.

Type string

The type of request. Indicates whether the EC2 Fleet only requests the target capacity, or also attempts to maintain it. Valid values: maintain, request. Defaults to maintain.

launchTemplateConfig FleetLaunchTemplateConfig

Nested argument containing EC2 Launch Template configurations. Defined below.

targetCapacitySpecification FleetTargetCapacitySpecification

Nested argument containing target capacity configurations. Defined below.

excessCapacityTerminationPolicy string

Whether running instances should be terminated if the total target capacity of the EC2 Fleet is decreased below the current size of the EC2. Valid values: no-termination, termination. Defaults to termination.

onDemandOptions FleetOnDemandOptions

Nested argument containing On-Demand configurations. Defined below.

replaceUnhealthyInstances boolean

Whether EC2 Fleet should replace unhealthy instances. Defaults to false.

spotOptions FleetSpotOptions

Nested argument containing Spot configurations. Defined below.

tags {[key: string]: string}

Map of Fleet tags. To tag instances at launch, specify the tags in the Launch Template.

terminateInstances boolean

Whether to terminate instances for an EC2 Fleet if it is deleted successfully. Defaults to false.

terminateInstancesWithExpiration boolean

Whether running instances should be terminated when the EC2 Fleet expires. Defaults to false.

type string

The type of request. Indicates whether the EC2 Fleet only requests the target capacity, or also attempts to maintain it. Valid values: maintain, request. Defaults to maintain.

launch_template_config Dict[FleetLaunchTemplateConfig]

Nested argument containing EC2 Launch Template configurations. Defined below.

target_capacity_specification Dict[FleetTargetCapacitySpecification]

Nested argument containing target capacity configurations. Defined below.

excess_capacity_termination_policy str

Whether running instances should be terminated if the total target capacity of the EC2 Fleet is decreased below the current size of the EC2. Valid values: no-termination, termination. Defaults to termination.

on_demand_options Dict[FleetOnDemandOptions]

Nested argument containing On-Demand configurations. Defined below.

replace_unhealthy_instances bool

Whether EC2 Fleet should replace unhealthy instances. Defaults to false.

spot_options Dict[FleetSpotOptions]

Nested argument containing Spot configurations. Defined below.

tags Dict[str, str]

Map of Fleet tags. To tag instances at launch, specify the tags in the Launch Template.

terminate_instances bool

Whether to terminate instances for an EC2 Fleet if it is deleted successfully. Defaults to false.

terminate_instances_with_expiration bool

Whether running instances should be terminated when the EC2 Fleet expires. Defaults to false.

type str

The type of request. Indicates whether the EC2 Fleet only requests the target capacity, or also attempts to maintain it. Valid values: maintain, request. Defaults to maintain.

Outputs

All input properties are implicitly available as output properties. Additionally, the Fleet resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing Fleet Resource

Get an existing Fleet resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: FleetState, opts?: CustomResourceOptions): Fleet
static get(resource_name, id, opts=None, excess_capacity_termination_policy=None, launch_template_config=None, on_demand_options=None, replace_unhealthy_instances=None, spot_options=None, tags=None, target_capacity_specification=None, terminate_instances=None, terminate_instances_with_expiration=None, type=None, __props__=None);
func GetFleet(ctx *Context, name string, id IDInput, state *FleetState, opts ...ResourceOption) (*Fleet, error)
public static Fleet Get(string name, Input<string> id, FleetState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

ExcessCapacityTerminationPolicy string

Whether running instances should be terminated if the total target capacity of the EC2 Fleet is decreased below the current size of the EC2. Valid values: no-termination, termination. Defaults to termination.

LaunchTemplateConfig FleetLaunchTemplateConfigArgs

Nested argument containing EC2 Launch Template configurations. Defined below.

OnDemandOptions FleetOnDemandOptionsArgs

Nested argument containing On-Demand configurations. Defined below.

ReplaceUnhealthyInstances bool

Whether EC2 Fleet should replace unhealthy instances. Defaults to false.

SpotOptions FleetSpotOptionsArgs

Nested argument containing Spot configurations. Defined below.

Tags Dictionary<string, string>

Map of Fleet tags. To tag instances at launch, specify the tags in the Launch Template.

TargetCapacitySpecification FleetTargetCapacitySpecificationArgs

Nested argument containing target capacity configurations. Defined below.

TerminateInstances bool

Whether to terminate instances for an EC2 Fleet if it is deleted successfully. Defaults to false.

TerminateInstancesWithExpiration bool

Whether running instances should be terminated when the EC2 Fleet expires. Defaults to false.

Type string

The type of request. Indicates whether the EC2 Fleet only requests the target capacity, or also attempts to maintain it. Valid values: maintain, request. Defaults to maintain.

ExcessCapacityTerminationPolicy string

Whether running instances should be terminated if the total target capacity of the EC2 Fleet is decreased below the current size of the EC2. Valid values: no-termination, termination. Defaults to termination.

LaunchTemplateConfig FleetLaunchTemplateConfig

Nested argument containing EC2 Launch Template configurations. Defined below.

OnDemandOptions FleetOnDemandOptions

Nested argument containing On-Demand configurations. Defined below.

ReplaceUnhealthyInstances bool

Whether EC2 Fleet should replace unhealthy instances. Defaults to false.

SpotOptions FleetSpotOptions

Nested argument containing Spot configurations. Defined below.

Tags map[string]string

Map of Fleet tags. To tag instances at launch, specify the tags in the Launch Template.

TargetCapacitySpecification FleetTargetCapacitySpecification

Nested argument containing target capacity configurations. Defined below.

TerminateInstances bool

Whether to terminate instances for an EC2 Fleet if it is deleted successfully. Defaults to false.

TerminateInstancesWithExpiration bool

Whether running instances should be terminated when the EC2 Fleet expires. Defaults to false.

Type string

The type of request. Indicates whether the EC2 Fleet only requests the target capacity, or also attempts to maintain it. Valid values: maintain, request. Defaults to maintain.

excessCapacityTerminationPolicy string

Whether running instances should be terminated if the total target capacity of the EC2 Fleet is decreased below the current size of the EC2. Valid values: no-termination, termination. Defaults to termination.

launchTemplateConfig FleetLaunchTemplateConfig

Nested argument containing EC2 Launch Template configurations. Defined below.

onDemandOptions FleetOnDemandOptions

Nested argument containing On-Demand configurations. Defined below.

replaceUnhealthyInstances boolean

Whether EC2 Fleet should replace unhealthy instances. Defaults to false.

spotOptions FleetSpotOptions

Nested argument containing Spot configurations. Defined below.

tags {[key: string]: string}

Map of Fleet tags. To tag instances at launch, specify the tags in the Launch Template.

targetCapacitySpecification FleetTargetCapacitySpecification

Nested argument containing target capacity configurations. Defined below.

terminateInstances boolean

Whether to terminate instances for an EC2 Fleet if it is deleted successfully. Defaults to false.

terminateInstancesWithExpiration boolean

Whether running instances should be terminated when the EC2 Fleet expires. Defaults to false.

type string

The type of request. Indicates whether the EC2 Fleet only requests the target capacity, or also attempts to maintain it. Valid values: maintain, request. Defaults to maintain.

excess_capacity_termination_policy str

Whether running instances should be terminated if the total target capacity of the EC2 Fleet is decreased below the current size of the EC2. Valid values: no-termination, termination. Defaults to termination.

launch_template_config Dict[FleetLaunchTemplateConfig]

Nested argument containing EC2 Launch Template configurations. Defined below.

on_demand_options Dict[FleetOnDemandOptions]

Nested argument containing On-Demand configurations. Defined below.

replace_unhealthy_instances bool

Whether EC2 Fleet should replace unhealthy instances. Defaults to false.

spot_options Dict[FleetSpotOptions]

Nested argument containing Spot configurations. Defined below.

tags Dict[str, str]

Map of Fleet tags. To tag instances at launch, specify the tags in the Launch Template.

target_capacity_specification Dict[FleetTargetCapacitySpecification]

Nested argument containing target capacity configurations. Defined below.

terminate_instances bool

Whether to terminate instances for an EC2 Fleet if it is deleted successfully. Defaults to false.

terminate_instances_with_expiration bool

Whether running instances should be terminated when the EC2 Fleet expires. Defaults to false.

type str

The type of request. Indicates whether the EC2 Fleet only requests the target capacity, or also attempts to maintain it. Valid values: maintain, request. Defaults to maintain.

Supporting Types

FleetLaunchTemplateConfig

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

LaunchTemplateSpecification FleetLaunchTemplateConfigLaunchTemplateSpecificationArgs

Nested argument containing EC2 Launch Template to use. Defined below.

Overrides List<FleetLaunchTemplateConfigOverrideArgs>

Nested argument(s) containing parameters to override the same parameters in the Launch Template. Defined below.

LaunchTemplateSpecification FleetLaunchTemplateConfigLaunchTemplateSpecification

Nested argument containing EC2 Launch Template to use. Defined below.

Overrides []FleetLaunchTemplateConfigOverride

Nested argument(s) containing parameters to override the same parameters in the Launch Template. Defined below.

launchTemplateSpecification FleetLaunchTemplateConfigLaunchTemplateSpecification

Nested argument containing EC2 Launch Template to use. Defined below.

overrides FleetLaunchTemplateConfigOverride[]

Nested argument(s) containing parameters to override the same parameters in the Launch Template. Defined below.

launchTemplateSpecification Dict[FleetLaunchTemplateConfigLaunchTemplateSpecification]

Nested argument containing EC2 Launch Template to use. Defined below.

overrides List[FleetLaunchTemplateConfigOverride]

Nested argument(s) containing parameters to override the same parameters in the Launch Template. Defined below.

FleetLaunchTemplateConfigLaunchTemplateSpecification

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Version string

Version number of the launch template.

LaunchTemplateId string

ID of the launch template.

LaunchTemplateName string

Name of the launch template.

Version string

Version number of the launch template.

LaunchTemplateId string

ID of the launch template.

LaunchTemplateName string

Name of the launch template.

version string

Version number of the launch template.

launchTemplateId string

ID of the launch template.

launchTemplateName string

Name of the launch template.

version str

Version number of the launch template.

launchTemplateId str

ID of the launch template.

launchTemplateName str

Name of the launch template.

FleetLaunchTemplateConfigOverride

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

AvailabilityZone string

Availability Zone in which to launch the instances.

InstanceType string

Instance type.

MaxPrice string

Maximum price per unit hour that you are willing to pay for a Spot Instance.

Priority double

Priority for the launch template override. If on_demand_options allocation_strategy is set to prioritized, EC2 Fleet uses priority to determine which launch template override to use first in fulfilling On-Demand capacity. The highest priority is launched first. The lower the number, the higher the priority. If no number is set, the launch template override has the lowest priority. Valid values are whole numbers starting at 0.

SubnetId string

ID of the subnet in which to launch the instances.

WeightedCapacity double

Number of units provided by the specified instance type.

AvailabilityZone string

Availability Zone in which to launch the instances.

InstanceType string

Instance type.

MaxPrice string

Maximum price per unit hour that you are willing to pay for a Spot Instance.

Priority float64

Priority for the launch template override. If on_demand_options allocation_strategy is set to prioritized, EC2 Fleet uses priority to determine which launch template override to use first in fulfilling On-Demand capacity. The highest priority is launched first. The lower the number, the higher the priority. If no number is set, the launch template override has the lowest priority. Valid values are whole numbers starting at 0.

SubnetId string

ID of the subnet in which to launch the instances.

WeightedCapacity float64

Number of units provided by the specified instance type.

availabilityZone string

Availability Zone in which to launch the instances.

instanceType string

Instance type.

maxPrice string

Maximum price per unit hour that you are willing to pay for a Spot Instance.

priority number

Priority for the launch template override. If on_demand_options allocation_strategy is set to prioritized, EC2 Fleet uses priority to determine which launch template override to use first in fulfilling On-Demand capacity. The highest priority is launched first. The lower the number, the higher the priority. If no number is set, the launch template override has the lowest priority. Valid values are whole numbers starting at 0.

subnetId string

ID of the subnet in which to launch the instances.

weightedCapacity number

Number of units provided by the specified instance type.

availability_zone str

Availability Zone in which to launch the instances.

instance_type str

Instance type.

maxPrice str

Maximum price per unit hour that you are willing to pay for a Spot Instance.

priority float

Priority for the launch template override. If on_demand_options allocation_strategy is set to prioritized, EC2 Fleet uses priority to determine which launch template override to use first in fulfilling On-Demand capacity. The highest priority is launched first. The lower the number, the higher the priority. If no number is set, the launch template override has the lowest priority. Valid values are whole numbers starting at 0.

subnet_id str

ID of the subnet in which to launch the instances.

weightedCapacity float

Number of units provided by the specified instance type.

FleetOnDemandOptions

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

AllocationStrategy string

How to allocate the target capacity across the Spot pools. Valid values: diversified, lowestPrice. Default: lowestPrice.

AllocationStrategy string

How to allocate the target capacity across the Spot pools. Valid values: diversified, lowestPrice. Default: lowestPrice.

allocationStrategy string

How to allocate the target capacity across the Spot pools. Valid values: diversified, lowestPrice. Default: lowestPrice.

allocation_strategy str

How to allocate the target capacity across the Spot pools. Valid values: diversified, lowestPrice. Default: lowestPrice.

FleetSpotOptions

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

AllocationStrategy string

How to allocate the target capacity across the Spot pools. Valid values: diversified, lowestPrice. Default: lowestPrice.

InstanceInterruptionBehavior string

Behavior when a Spot Instance is interrupted. Valid values: hibernate, stop, terminate. Default: terminate.

InstancePoolsToUseCount int

Number of Spot pools across which to allocate your target Spot capacity. Valid only when Spot allocation_strategy is set to lowestPrice. Default: 1.

AllocationStrategy string

How to allocate the target capacity across the Spot pools. Valid values: diversified, lowestPrice. Default: lowestPrice.

InstanceInterruptionBehavior string

Behavior when a Spot Instance is interrupted. Valid values: hibernate, stop, terminate. Default: terminate.

InstancePoolsToUseCount int

Number of Spot pools across which to allocate your target Spot capacity. Valid only when Spot allocation_strategy is set to lowestPrice. Default: 1.

allocationStrategy string

How to allocate the target capacity across the Spot pools. Valid values: diversified, lowestPrice. Default: lowestPrice.

instanceInterruptionBehavior string

Behavior when a Spot Instance is interrupted. Valid values: hibernate, stop, terminate. Default: terminate.

instancePoolsToUseCount number

Number of Spot pools across which to allocate your target Spot capacity. Valid only when Spot allocation_strategy is set to lowestPrice. Default: 1.

allocation_strategy str

How to allocate the target capacity across the Spot pools. Valid values: diversified, lowestPrice. Default: lowestPrice.

instanceInterruptionBehavior str

Behavior when a Spot Instance is interrupted. Valid values: hibernate, stop, terminate. Default: terminate.

instance_pools_to_use_count float

Number of Spot pools across which to allocate your target Spot capacity. Valid only when Spot allocation_strategy is set to lowestPrice. Default: 1.

FleetTargetCapacitySpecification

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

DefaultTargetCapacityType string

Default target capacity type. Valid values: on-demand, spot.

TotalTargetCapacity int

The number of units to request, filled using default_target_capacity_type.

OnDemandTargetCapacity int

The number of On-Demand units to request.

SpotTargetCapacity int

The number of Spot units to request.

DefaultTargetCapacityType string

Default target capacity type. Valid values: on-demand, spot.

TotalTargetCapacity int

The number of units to request, filled using default_target_capacity_type.

OnDemandTargetCapacity int

The number of On-Demand units to request.

SpotTargetCapacity int

The number of Spot units to request.

defaultTargetCapacityType string

Default target capacity type. Valid values: on-demand, spot.

totalTargetCapacity number

The number of units to request, filled using default_target_capacity_type.

onDemandTargetCapacity number

The number of On-Demand units to request.

spotTargetCapacity number

The number of Spot units to request.

defaultTargetCapacityType str

Default target capacity type. Valid values: on-demand, spot.

totalTargetCapacity float

The number of units to request, filled using default_target_capacity_type.

onDemandTargetCapacity float

The number of On-Demand units to request.

spotTargetCapacity float

The number of Spot units to request.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.