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);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:
- Launch
Template FleetConfig Launch Template Config Args Nested argument containing EC2 Launch Template configurations. Defined below.
- Target
Capacity FleetSpecification Target Capacity Specification Args Nested argument containing target capacity configurations. Defined below.
- Excess
Capacity stringTermination Policy 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 totermination.- On
Demand FleetOptions On Demand Options Args Nested argument containing On-Demand configurations. Defined below.
- Replace
Unhealthy boolInstances Whether EC2 Fleet should replace unhealthy instances. Defaults to
false.- Spot
Options FleetSpot Options Args Nested argument containing Spot configurations. Defined below.
- Dictionary<string, string>
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 boolWith Expiration 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 tomaintain.
- Launch
Template FleetConfig Launch Template Config Nested argument containing EC2 Launch Template configurations. Defined below.
- Target
Capacity FleetSpecification Target Capacity Specification Nested argument containing target capacity configurations. Defined below.
- Excess
Capacity stringTermination Policy 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 totermination.- On
Demand FleetOptions On Demand Options Nested argument containing On-Demand configurations. Defined below.
- Replace
Unhealthy boolInstances Whether EC2 Fleet should replace unhealthy instances. Defaults to
false.- Spot
Options FleetSpot Options Nested argument containing Spot configurations. Defined below.
- map[string]string
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 boolWith Expiration 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 tomaintain.
- launch
Template FleetConfig Launch Template Config Nested argument containing EC2 Launch Template configurations. Defined below.
- target
Capacity FleetSpecification Target Capacity Specification Nested argument containing target capacity configurations. Defined below.
- excess
Capacity stringTermination Policy 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 totermination.- on
Demand FleetOptions On Demand Options Nested argument containing On-Demand configurations. Defined below.
- replace
Unhealthy booleanInstances Whether EC2 Fleet should replace unhealthy instances. Defaults to
false.- spot
Options FleetSpot Options Nested argument containing Spot configurations. Defined below.
- {[key: string]: string}
Map of Fleet tags. To tag instances at launch, specify the tags in the Launch Template.
- terminate
Instances boolean Whether to terminate instances for an EC2 Fleet if it is deleted successfully. Defaults to
false.- terminate
Instances booleanWith Expiration 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 tomaintain.
- launch_
template_ Dict[Fleetconfig Launch Template Config] Nested argument containing EC2 Launch Template configurations. Defined below.
- target_
capacity_ Dict[Fleetspecification Target Capacity Specification] Nested argument containing target capacity configurations. Defined below.
- excess_
capacity_ strtermination_ policy 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 totermination.- on_
demand_ Dict[Fleetoptions On Demand Options] Nested argument containing On-Demand configurations. Defined below.
- replace_
unhealthy_ boolinstances Whether EC2 Fleet should replace unhealthy instances. Defaults to
false.- spot_
options Dict[FleetSpot Options] Nested argument containing Spot configurations. Defined below.
- 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_ boolwith_ expiration 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 tomaintain.
Outputs
All input properties are implicitly available as output properties. Additionally, the Fleet resource produces the following output properties:
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): Fleetstatic 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:
- Excess
Capacity stringTermination Policy 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 totermination.- Launch
Template FleetConfig Launch Template Config Args Nested argument containing EC2 Launch Template configurations. Defined below.
- On
Demand FleetOptions On Demand Options Args Nested argument containing On-Demand configurations. Defined below.
- Replace
Unhealthy boolInstances Whether EC2 Fleet should replace unhealthy instances. Defaults to
false.- Spot
Options FleetSpot Options Args Nested argument containing Spot configurations. Defined below.
- Dictionary<string, string>
Map of Fleet tags. To tag instances at launch, specify the tags in the Launch Template.
- Target
Capacity FleetSpecification Target Capacity Specification Args 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 boolWith Expiration 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 tomaintain.
- Excess
Capacity stringTermination Policy 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 totermination.- Launch
Template FleetConfig Launch Template Config Nested argument containing EC2 Launch Template configurations. Defined below.
- On
Demand FleetOptions On Demand Options Nested argument containing On-Demand configurations. Defined below.
- Replace
Unhealthy boolInstances Whether EC2 Fleet should replace unhealthy instances. Defaults to
false.- Spot
Options FleetSpot Options Nested argument containing Spot configurations. Defined below.
- map[string]string
Map of Fleet tags. To tag instances at launch, specify the tags in the Launch Template.
- Target
Capacity FleetSpecification Target Capacity Specification 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 boolWith Expiration 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 tomaintain.
- excess
Capacity stringTermination Policy 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 totermination.- launch
Template FleetConfig Launch Template Config Nested argument containing EC2 Launch Template configurations. Defined below.
- on
Demand FleetOptions On Demand Options Nested argument containing On-Demand configurations. Defined below.
- replace
Unhealthy booleanInstances Whether EC2 Fleet should replace unhealthy instances. Defaults to
false.- spot
Options FleetSpot Options Nested argument containing Spot configurations. Defined below.
- {[key: string]: string}
Map of Fleet tags. To tag instances at launch, specify the tags in the Launch Template.
- target
Capacity FleetSpecification Target Capacity Specification Nested argument containing target capacity configurations. Defined below.
- terminate
Instances boolean Whether to terminate instances for an EC2 Fleet if it is deleted successfully. Defaults to
false.- terminate
Instances booleanWith Expiration 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 tomaintain.
- excess_
capacity_ strtermination_ policy 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 totermination.- launch_
template_ Dict[Fleetconfig Launch Template Config] Nested argument containing EC2 Launch Template configurations. Defined below.
- on_
demand_ Dict[Fleetoptions On Demand Options] Nested argument containing On-Demand configurations. Defined below.
- replace_
unhealthy_ boolinstances Whether EC2 Fleet should replace unhealthy instances. Defaults to
false.- spot_
options Dict[FleetSpot Options] Nested argument containing Spot configurations. Defined below.
- Dict[str, str]
Map of Fleet tags. To tag instances at launch, specify the tags in the Launch Template.
- target_
capacity_ Dict[Fleetspecification Target Capacity Specification] 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_ boolwith_ expiration 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 tomaintain.
Supporting Types
FleetLaunchTemplateConfig
- Launch
Template FleetSpecification Launch Template Config Launch Template Specification Args Nested argument containing EC2 Launch Template to use. Defined below.
- Overrides
List<Fleet
Launch Template Config Override Args> Nested argument(s) containing parameters to override the same parameters in the Launch Template. Defined below.
- Launch
Template FleetSpecification Launch Template Config Launch Template Specification Nested argument containing EC2 Launch Template to use. Defined below.
- Overrides
[]Fleet
Launch Template Config Override Nested argument(s) containing parameters to override the same parameters in the Launch Template. Defined below.
- launch
Template FleetSpecification Launch Template Config Launch Template Specification Nested argument containing EC2 Launch Template to use. Defined below.
- overrides
Fleet
Launch Template Config Override[] Nested argument(s) containing parameters to override the same parameters in the Launch Template. Defined below.
- launch
Template Dict[FleetSpecification Launch Template Config Launch Template Specification] Nested argument containing EC2 Launch Template to use. Defined below.
- overrides
List[Fleet
Launch Template Config Override] Nested argument(s) containing parameters to override the same parameters in the Launch Template. Defined below.
FleetLaunchTemplateConfigLaunchTemplateSpecification
- Version string
Version number of the launch template.
- Launch
Template stringId ID of the launch template.
- Launch
Template stringName Name of the launch template.
- Version string
Version number of the launch template.
- Launch
Template stringId ID of the launch template.
- Launch
Template stringName Name of the launch template.
- version string
Version number of the launch template.
- launch
Template stringId ID of the launch template.
- launch
Template stringName Name of the launch template.
- version str
Version number of the launch template.
- launch
Template strId ID of the launch template.
- launch
Template strName Name of the launch template.
FleetLaunchTemplateConfigOverride
- Availability
Zone string Availability Zone in which to launch the instances.
- Instance
Type string Instance type.
- Max
Price 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_optionsallocation_strategyis set toprioritized, 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 string ID of the subnet in which to launch the instances.
- Weighted
Capacity double Number of units provided by the specified instance type.
- Availability
Zone string Availability Zone in which to launch the instances.
- Instance
Type string Instance type.
- Max
Price 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_optionsallocation_strategyis set toprioritized, 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 string ID of the subnet in which to launch the instances.
- Weighted
Capacity float64 Number of units provided by the specified instance type.
- availability
Zone string Availability Zone in which to launch the instances.
- instance
Type string Instance type.
- max
Price 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_optionsallocation_strategyis set toprioritized, 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 string ID of the subnet in which to launch the instances.
- weighted
Capacity 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.
- max
Price 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_optionsallocation_strategyis set toprioritized, 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.
- weighted
Capacity float Number of units provided by the specified instance type.
FleetOnDemandOptions
- Allocation
Strategy string How to allocate the target capacity across the Spot pools. Valid values:
diversified,lowestPrice. Default:lowestPrice.
- Allocation
Strategy string How to allocate the target capacity across the Spot pools. Valid values:
diversified,lowestPrice. Default:lowestPrice.
- allocation
Strategy 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
- Allocation
Strategy string How to allocate the target capacity across the Spot pools. Valid values:
diversified,lowestPrice. Default:lowestPrice.- Instance
Interruption stringBehavior Behavior when a Spot Instance is interrupted. Valid values:
hibernate,stop,terminate. Default:terminate.- Instance
Pools intTo Use Count Number of Spot pools across which to allocate your target Spot capacity. Valid only when Spot
allocation_strategyis set tolowestPrice. Default:1.
- Allocation
Strategy string How to allocate the target capacity across the Spot pools. Valid values:
diversified,lowestPrice. Default:lowestPrice.- Instance
Interruption stringBehavior Behavior when a Spot Instance is interrupted. Valid values:
hibernate,stop,terminate. Default:terminate.- Instance
Pools intTo Use Count Number of Spot pools across which to allocate your target Spot capacity. Valid only when Spot
allocation_strategyis set tolowestPrice. Default:1.
- allocation
Strategy string How to allocate the target capacity across the Spot pools. Valid values:
diversified,lowestPrice. Default:lowestPrice.- instance
Interruption stringBehavior Behavior when a Spot Instance is interrupted. Valid values:
hibernate,stop,terminate. Default:terminate.- instance
Pools numberTo Use Count Number of Spot pools across which to allocate your target Spot capacity. Valid only when Spot
allocation_strategyis set tolowestPrice. Default:1.
- allocation_
strategy str How to allocate the target capacity across the Spot pools. Valid values:
diversified,lowestPrice. Default:lowestPrice.- instance
Interruption strBehavior Behavior when a Spot Instance is interrupted. Valid values:
hibernate,stop,terminate. Default:terminate.- instance_
pools_ floatto_ use_ count Number of Spot pools across which to allocate your target Spot capacity. Valid only when Spot
allocation_strategyis set tolowestPrice. Default:1.
FleetTargetCapacitySpecification
- Default
Target stringCapacity Type Default target capacity type. Valid values:
on-demand,spot.- Total
Target intCapacity The number of units to request, filled using
default_target_capacity_type.- On
Demand intTarget Capacity The number of On-Demand units to request.
- Spot
Target intCapacity The number of Spot units to request.
- Default
Target stringCapacity Type Default target capacity type. Valid values:
on-demand,spot.- Total
Target intCapacity The number of units to request, filled using
default_target_capacity_type.- On
Demand intTarget Capacity The number of On-Demand units to request.
- Spot
Target intCapacity The number of Spot units to request.
- default
Target stringCapacity Type Default target capacity type. Valid values:
on-demand,spot.- total
Target numberCapacity The number of units to request, filled using
default_target_capacity_type.- on
Demand numberTarget Capacity The number of On-Demand units to request.
- spot
Target numberCapacity The number of Spot units to request.
- default
Target strCapacity Type Default target capacity type. Valid values:
on-demand,spot.- total
Target floatCapacity The number of units to request, filled using
default_target_capacity_type.- on
Demand floatTarget Capacity The number of On-Demand units to request.
- spot
Target floatCapacity 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
awsTerraform Provider.