SpotFleetRequest
Provides an EC2 Spot Fleet Request resource. This allows a fleet of Spot instances to be requested on the Spot market.
Example Usage
Using launch specifications
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
// Request a Spot fleet
var cheapCompute = new Aws.Ec2.SpotFleetRequest("cheapCompute", new Aws.Ec2.SpotFleetRequestArgs
{
AllocationStrategy = "diversified",
IamFleetRole = "arn:aws:iam::12345678:role/spot-fleet",
LaunchSpecifications =
{
new Aws.Ec2.Inputs.SpotFleetRequestLaunchSpecificationArgs
{
Ami = "ami-1234",
IamInstanceProfileArn = aws_iam_instance_profile.Example.Arn,
InstanceType = "m4.10xlarge",
PlacementTenancy = "dedicated",
SpotPrice = "2.793",
},
new Aws.Ec2.Inputs.SpotFleetRequestLaunchSpecificationArgs
{
Ami = "ami-5678",
AvailabilityZone = "us-west-1a",
IamInstanceProfileArn = aws_iam_instance_profile.Example.Arn,
InstanceType = "m4.4xlarge",
KeyName = "my-key",
RootBlockDevices =
{
new Aws.Ec2.Inputs.SpotFleetRequestLaunchSpecificationRootBlockDeviceArgs
{
VolumeSize = 300,
VolumeType = "gp2",
},
},
SpotPrice = "1.117",
SubnetId = "subnet-1234",
Tags =
{
{ "Name", "spot-fleet-example" },
},
WeightedCapacity = "35",
},
},
SpotPrice = "0.03",
TargetCapacity = 6,
ValidUntil = "2019-11-04T20:44:20Z",
});
}
}
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.NewSpotFleetRequest(ctx, "cheapCompute", &ec2.SpotFleetRequestArgs{
AllocationStrategy: pulumi.String("diversified"),
IamFleetRole: pulumi.String("arn:aws:iam::12345678:role/spot-fleet"),
LaunchSpecifications: ec2.SpotFleetRequestLaunchSpecificationArray{
&ec2.SpotFleetRequestLaunchSpecificationArgs{
Ami: pulumi.String("ami-1234"),
IamInstanceProfileArn: pulumi.String(aws_iam_instance_profile.Example.Arn),
InstanceType: pulumi.String("m4.10xlarge"),
PlacementTenancy: pulumi.String("dedicated"),
SpotPrice: pulumi.String("2.793"),
},
&ec2.SpotFleetRequestLaunchSpecificationArgs{
Ami: pulumi.String("ami-5678"),
AvailabilityZone: pulumi.String("us-west-1a"),
IamInstanceProfileArn: pulumi.String(aws_iam_instance_profile.Example.Arn),
InstanceType: pulumi.String("m4.4xlarge"),
KeyName: pulumi.String("my-key"),
RootBlockDevices: ec2.SpotFleetRequestLaunchSpecificationRootBlockDeviceArray{
&ec2.SpotFleetRequestLaunchSpecificationRootBlockDeviceArgs{
VolumeSize: pulumi.Int(300),
VolumeType: pulumi.String("gp2"),
},
},
SpotPrice: pulumi.String("1.117"),
SubnetId: pulumi.String("subnet-1234"),
Tags: pulumi.StringMap{
"Name": pulumi.String("spot-fleet-example"),
},
WeightedCapacity: pulumi.String("35"),
},
},
SpotPrice: pulumi.String("0.03"),
TargetCapacity: pulumi.Int(6),
ValidUntil: pulumi.String("2019-11-04T20:44:20Z"),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
# Request a Spot fleet
cheap_compute = aws.ec2.SpotFleetRequest("cheapCompute",
allocation_strategy="diversified",
iam_fleet_role="arn:aws:iam::12345678:role/spot-fleet",
launch_specifications=[
{
"ami": "ami-1234",
"iamInstanceProfileArn": aws_iam_instance_profile["example"]["arn"],
"instance_type": "m4.10xlarge",
"placement_tenancy": "dedicated",
"spot_price": "2.793",
},
{
"ami": "ami-5678",
"availability_zone": "us-west-1a",
"iamInstanceProfileArn": aws_iam_instance_profile["example"]["arn"],
"instance_type": "m4.4xlarge",
"key_name": "my-key",
"root_block_devices": [{
"volume_size": "300",
"volumeType": "gp2",
}],
"spot_price": "1.117",
"subnet_id": "subnet-1234",
"tags": {
"Name": "spot-fleet-example",
},
"weightedCapacity": 35,
},
],
spot_price="0.03",
target_capacity=6,
valid_until="2019-11-04T20:44:20Z")import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
// Request a Spot fleet
const cheapCompute = new aws.ec2.SpotFleetRequest("cheap_compute", {
allocationStrategy: "diversified",
iamFleetRole: "arn:aws:iam::12345678:role/spot-fleet",
launchSpecifications: [
{
ami: "ami-1234",
iamInstanceProfileArn: aws_iam_instance_profile_example.arn,
instanceType: "m4.10xlarge",
placementTenancy: "dedicated",
spotPrice: "2.793",
},
{
ami: "ami-5678",
availabilityZone: "us-west-1a",
iamInstanceProfileArn: aws_iam_instance_profile_example.arn,
instanceType: "m4.4xlarge",
keyName: "my-key",
rootBlockDevices: [{
volumeSize: 300,
volumeType: "gp2",
}],
spotPrice: "1.117",
subnetId: "subnet-1234",
tags: {
Name: "spot-fleet-example",
},
weightedCapacity: "35",
},
],
spotPrice: "0.03",
targetCapacity: 6,
validUntil: "2019-11-04T20:44:20Z",
});Using launch templates
Coming soon!
Coming soon!
import pulumi
import pulumi_aws as aws
foo_launch_template = aws.ec2.LaunchTemplate("fooLaunchTemplate",
image_id="ami-516b9131",
instance_type="m1.small",
key_name="some-key",
spot_price="0.05")
foo_spot_fleet_request = aws.ec2.SpotFleetRequest("fooSpotFleetRequest",
iam_fleet_role="arn:aws:iam::12345678:role/spot-fleet",
spot_price="0.005",
target_capacity=2,
valid_until="2019-11-04T20:44:20Z",
launch_template_configs=[{
"launchTemplateSpecification": {
"id": foo_launch_template.id,
"version": foo_launch_template.latest_version,
},
}],
opts=ResourceOptions(depends_on=["aws_iam_policy_attachment.test-attach"]))import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const fooLaunchTemplate = new aws.ec2.LaunchTemplate("fooLaunchTemplate", {
imageId: "ami-516b9131",
instanceType: "m1.small",
keyName: "some-key",
spotPrice: "0.05",
});
const fooSpotFleetRequest = new aws.ec2.SpotFleetRequest("fooSpotFleetRequest", {
iamFleetRole: "arn:aws:iam::12345678:role/spot-fleet",
spotPrice: "0.005",
targetCapacity: 2,
validUntil: "2019-11-04T20:44:20Z",
launchTemplateConfigs: [{
launchTemplateSpecification: {
id: fooLaunchTemplate.id,
version: fooLaunchTemplate.latestVersion,
},
}],
}, {
dependsOn: ["aws_iam_policy_attachment.test-attach"],
});Using multiple launch specifications
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var foo = new Aws.Ec2.SpotFleetRequest("foo", new Aws.Ec2.SpotFleetRequestArgs
{
IamFleetRole = "arn:aws:iam::12345678:role/spot-fleet",
LaunchSpecifications =
{
new Aws.Ec2.Inputs.SpotFleetRequestLaunchSpecificationArgs
{
Ami = "ami-d06a90b0",
AvailabilityZone = "us-west-2a",
InstanceType = "m1.small",
KeyName = "my-key",
},
new Aws.Ec2.Inputs.SpotFleetRequestLaunchSpecificationArgs
{
Ami = "ami-d06a90b0",
AvailabilityZone = "us-west-2a",
InstanceType = "m5.large",
KeyName = "my-key",
},
},
SpotPrice = "0.005",
TargetCapacity = 2,
ValidUntil = "2019-11-04T20:44:20Z",
});
}
}
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.NewSpotFleetRequest(ctx, "foo", &ec2.SpotFleetRequestArgs{
IamFleetRole: pulumi.String("arn:aws:iam::12345678:role/spot-fleet"),
LaunchSpecifications: ec2.SpotFleetRequestLaunchSpecificationArray{
&ec2.SpotFleetRequestLaunchSpecificationArgs{
Ami: pulumi.String("ami-d06a90b0"),
AvailabilityZone: pulumi.String("us-west-2a"),
InstanceType: pulumi.String("m1.small"),
KeyName: pulumi.String("my-key"),
},
&ec2.SpotFleetRequestLaunchSpecificationArgs{
Ami: pulumi.String("ami-d06a90b0"),
AvailabilityZone: pulumi.String("us-west-2a"),
InstanceType: pulumi.String("m5.large"),
KeyName: pulumi.String("my-key"),
},
},
SpotPrice: pulumi.String("0.005"),
TargetCapacity: pulumi.Int(2),
ValidUntil: pulumi.String("2019-11-04T20:44:20Z"),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
foo = aws.ec2.SpotFleetRequest("foo",
iam_fleet_role="arn:aws:iam::12345678:role/spot-fleet",
launch_specifications=[
{
"ami": "ami-d06a90b0",
"availability_zone": "us-west-2a",
"instance_type": "m1.small",
"key_name": "my-key",
},
{
"ami": "ami-d06a90b0",
"availability_zone": "us-west-2a",
"instance_type": "m5.large",
"key_name": "my-key",
},
],
spot_price="0.005",
target_capacity=2,
valid_until="2019-11-04T20:44:20Z")import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const foo = new aws.ec2.SpotFleetRequest("foo", {
iamFleetRole: "arn:aws:iam::12345678:role/spot-fleet",
launchSpecifications: [
{
ami: "ami-d06a90b0",
availabilityZone: "us-west-2a",
instanceType: "m1.small",
keyName: "my-key",
},
{
ami: "ami-d06a90b0",
availabilityZone: "us-west-2a",
instanceType: "m5.large",
keyName: "my-key",
},
],
spotPrice: "0.005",
targetCapacity: 2,
validUntil: "2019-11-04T20:44:20Z",
});Using multiple launch configurations
Coming soon!
Coming soon!
import pulumi
import pulumi_aws as aws
example = aws.ec2.get_subnet_ids(vpc_id=var["vpc_id"])
foo_launch_template = aws.ec2.LaunchTemplate("fooLaunchTemplate",
image_id="ami-516b9131",
instance_type="m1.small",
key_name="some-key",
spot_price="0.05")
foo_spot_fleet_request = aws.ec2.SpotFleetRequest("fooSpotFleetRequest",
iam_fleet_role="arn:aws:iam::12345678:role/spot-fleet",
spot_price="0.005",
target_capacity=2,
valid_until="2019-11-04T20:44:20Z",
launch_template_configs=[{
"launchTemplateSpecification": {
"id": foo_launch_template.id,
"version": foo_launch_template.latest_version,
},
"overrides": [
{
"subnet_id": data["aws_subnets"]["example"]["ids"],
},
{
"subnet_id": data["aws_subnets"]["example"]["ids"],
},
{
"subnet_id": data["aws_subnets"]["example"]["ids"],
},
],
}],
opts=ResourceOptions(depends_on=["aws_iam_policy_attachment.test-attach"]))import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.ec2.getSubnetIds({
vpcId: _var.vpc_id,
});
const fooLaunchTemplate = new aws.ec2.LaunchTemplate("fooLaunchTemplate", {
imageId: "ami-516b9131",
instanceType: "m1.small",
keyName: "some-key",
spotPrice: "0.05",
});
const fooSpotFleetRequest = new aws.ec2.SpotFleetRequest("fooSpotFleetRequest", {
iamFleetRole: "arn:aws:iam::12345678:role/spot-fleet",
spotPrice: "0.005",
targetCapacity: 2,
validUntil: "2019-11-04T20:44:20Z",
launchTemplateConfigs: [{
launchTemplateSpecification: {
id: fooLaunchTemplate.id,
version: fooLaunchTemplate.latestVersion,
},
overrides: [
{
subnetId: data.aws_subnets.example.ids[0],
},
{
subnetId: data.aws_subnets.example.ids[1],
},
{
subnetId: data.aws_subnets.example.ids[2],
},
],
}],
}, {
dependsOn: ["aws_iam_policy_attachment.test-attach"],
});Create a SpotFleetRequest Resource
new SpotFleetRequest(name: string, args: SpotFleetRequestArgs, opts?: CustomResourceOptions);def SpotFleetRequest(resource_name, opts=None, allocation_strategy=None, excess_capacity_termination_policy=None, fleet_type=None, iam_fleet_role=None, instance_interruption_behaviour=None, instance_pools_to_use_count=None, launch_specifications=None, launch_template_configs=None, load_balancers=None, replace_unhealthy_instances=None, spot_price=None, tags=None, target_capacity=None, target_group_arns=None, terminate_instances_with_expiration=None, valid_from=None, valid_until=None, wait_for_fulfillment=None, __props__=None);func NewSpotFleetRequest(ctx *Context, name string, args SpotFleetRequestArgs, opts ...ResourceOption) (*SpotFleetRequest, error)public SpotFleetRequest(string name, SpotFleetRequestArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args SpotFleetRequestArgs
- 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 SpotFleetRequestArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SpotFleetRequestArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
SpotFleetRequest Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The SpotFleetRequest resource accepts the following input properties:
- Iam
Fleet stringRole Grants the Spot fleet permission to terminate Spot instances on your behalf when you cancel its Spot fleet request using CancelSpotFleetRequests or when the Spot fleet request expires, if you set terminateInstancesWithExpiration.
- Target
Capacity int The number of units to request. You can choose to set the target capacity in terms of instances or a performance characteristic that is important to your application workload, such as vCPUs, memory, or I/O.
- Allocation
Strategy string Indicates how to allocate the target capacity across the Spot pools specified by the Spot fleet request. The default is
lowestPrice.- Excess
Capacity stringTermination Policy Indicates whether running Spot instances should be terminated if the target capacity of the Spot fleet request is decreased below the current size of the Spot fleet.
- Fleet
Type string The type of fleet request. Indicates whether the Spot Fleet only requests the target capacity or also attempts to maintain it. Default is
maintain.- Instance
Interruption stringBehaviour Indicates whether a Spot instance stops or terminates when it is interrupted. Default is
terminate.- Instance
Pools intTo Use Count The number of Spot pools across which to allocate your target Spot capacity. Valid only when
allocation_strategyis set tolowestPrice. Spot Fleet selects the cheapest Spot pools and evenly allocates your target Spot capacity across the number of Spot pools that you specify.- Launch
Specifications List<SpotFleet Request Launch Specification Args> Used to define the launch configuration of the spot-fleet request. Can be specified multiple times to define different bids across different markets and instance types. Conflicts with
launch_template_config. At least one oflaunch_specificationorlaunch_template_configis required.- Launch
Template List<SpotConfigs Fleet Request Launch Template Config Args> Launch template configuration block. See Launch Template Configs below for more details. Conflicts with
launch_specification. At least one oflaunch_specificationorlaunch_template_configis required.- Load
Balancers List<string> A list of elastic load balancer names to add to the Spot fleet.
- Replace
Unhealthy boolInstances Indicates whether Spot fleet should replace unhealthy instances. Default
false.- Spot
Price string The maximum spot bid for this override request.
- Dictionary<string, string>
A map of tags to assign to the resource.
- Target
Group List<string>Arns A list of
aws.alb.TargetGroupARNs, for use with Application Load Balancing.- Terminate
Instances boolWith Expiration Indicates whether running Spot instances should be terminated when the Spot fleet request expires.
- Valid
From string The start date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request immediately.
- Valid
Until string The end date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). At this point, no new Spot instance requests are placed or enabled to fulfill the request. Defaults to 24 hours.
- Wait
For boolFulfillment If set, this provider will wait for the Spot Request to be fulfilled, and will throw an error if the timeout of 10m is reached.
- Iam
Fleet stringRole Grants the Spot fleet permission to terminate Spot instances on your behalf when you cancel its Spot fleet request using CancelSpotFleetRequests or when the Spot fleet request expires, if you set terminateInstancesWithExpiration.
- Target
Capacity int The number of units to request. You can choose to set the target capacity in terms of instances or a performance characteristic that is important to your application workload, such as vCPUs, memory, or I/O.
- Allocation
Strategy string Indicates how to allocate the target capacity across the Spot pools specified by the Spot fleet request. The default is
lowestPrice.- Excess
Capacity stringTermination Policy Indicates whether running Spot instances should be terminated if the target capacity of the Spot fleet request is decreased below the current size of the Spot fleet.
- Fleet
Type string The type of fleet request. Indicates whether the Spot Fleet only requests the target capacity or also attempts to maintain it. Default is
maintain.- Instance
Interruption stringBehaviour Indicates whether a Spot instance stops or terminates when it is interrupted. Default is
terminate.- Instance
Pools intTo Use Count The number of Spot pools across which to allocate your target Spot capacity. Valid only when
allocation_strategyis set tolowestPrice. Spot Fleet selects the cheapest Spot pools and evenly allocates your target Spot capacity across the number of Spot pools that you specify.- Launch
Specifications []SpotFleet Request Launch Specification Used to define the launch configuration of the spot-fleet request. Can be specified multiple times to define different bids across different markets and instance types. Conflicts with
launch_template_config. At least one oflaunch_specificationorlaunch_template_configis required.- Launch
Template []SpotConfigs Fleet Request Launch Template Config Launch template configuration block. See Launch Template Configs below for more details. Conflicts with
launch_specification. At least one oflaunch_specificationorlaunch_template_configis required.- Load
Balancers []string A list of elastic load balancer names to add to the Spot fleet.
- Replace
Unhealthy boolInstances Indicates whether Spot fleet should replace unhealthy instances. Default
false.- Spot
Price string The maximum spot bid for this override request.
- map[string]string
A map of tags to assign to the resource.
- Target
Group []stringArns A list of
aws.alb.TargetGroupARNs, for use with Application Load Balancing.- Terminate
Instances boolWith Expiration Indicates whether running Spot instances should be terminated when the Spot fleet request expires.
- Valid
From string The start date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request immediately.
- Valid
Until string The end date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). At this point, no new Spot instance requests are placed or enabled to fulfill the request. Defaults to 24 hours.
- Wait
For boolFulfillment If set, this provider will wait for the Spot Request to be fulfilled, and will throw an error if the timeout of 10m is reached.
- iam
Fleet stringRole Grants the Spot fleet permission to terminate Spot instances on your behalf when you cancel its Spot fleet request using CancelSpotFleetRequests or when the Spot fleet request expires, if you set terminateInstancesWithExpiration.
- target
Capacity number The number of units to request. You can choose to set the target capacity in terms of instances or a performance characteristic that is important to your application workload, such as vCPUs, memory, or I/O.
- allocation
Strategy string Indicates how to allocate the target capacity across the Spot pools specified by the Spot fleet request. The default is
lowestPrice.- excess
Capacity stringTermination Policy Indicates whether running Spot instances should be terminated if the target capacity of the Spot fleet request is decreased below the current size of the Spot fleet.
- fleet
Type string The type of fleet request. Indicates whether the Spot Fleet only requests the target capacity or also attempts to maintain it. Default is
maintain.- instance
Interruption stringBehaviour Indicates whether a Spot instance stops or terminates when it is interrupted. Default is
terminate.- instance
Pools numberTo Use Count The number of Spot pools across which to allocate your target Spot capacity. Valid only when
allocation_strategyis set tolowestPrice. Spot Fleet selects the cheapest Spot pools and evenly allocates your target Spot capacity across the number of Spot pools that you specify.- launch
Specifications SpotFleet Request Launch Specification[] Used to define the launch configuration of the spot-fleet request. Can be specified multiple times to define different bids across different markets and instance types. Conflicts with
launch_template_config. At least one oflaunch_specificationorlaunch_template_configis required.- launch
Template SpotConfigs Fleet Request Launch Template Config[] Launch template configuration block. See Launch Template Configs below for more details. Conflicts with
launch_specification. At least one oflaunch_specificationorlaunch_template_configis required.- load
Balancers string[] A list of elastic load balancer names to add to the Spot fleet.
- replace
Unhealthy booleanInstances Indicates whether Spot fleet should replace unhealthy instances. Default
false.- spot
Price string The maximum spot bid for this override request.
- {[key: string]: string}
A map of tags to assign to the resource.
- target
Group string[]Arns A list of
aws.alb.TargetGroupARNs, for use with Application Load Balancing.- terminate
Instances booleanWith Expiration Indicates whether running Spot instances should be terminated when the Spot fleet request expires.
- valid
From string The start date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request immediately.
- valid
Until string The end date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). At this point, no new Spot instance requests are placed or enabled to fulfill the request. Defaults to 24 hours.
- wait
For booleanFulfillment If set, this provider will wait for the Spot Request to be fulfilled, and will throw an error if the timeout of 10m is reached.
- iam_
fleet_ strrole Grants the Spot fleet permission to terminate Spot instances on your behalf when you cancel its Spot fleet request using CancelSpotFleetRequests or when the Spot fleet request expires, if you set terminateInstancesWithExpiration.
- target_
capacity float The number of units to request. You can choose to set the target capacity in terms of instances or a performance characteristic that is important to your application workload, such as vCPUs, memory, or I/O.
- allocation_
strategy str Indicates how to allocate the target capacity across the Spot pools specified by the Spot fleet request. The default is
lowestPrice.- excess_
capacity_ strtermination_ policy Indicates whether running Spot instances should be terminated if the target capacity of the Spot fleet request is decreased below the current size of the Spot fleet.
- fleet_
type str The type of fleet request. Indicates whether the Spot Fleet only requests the target capacity or also attempts to maintain it. Default is
maintain.- instance_
interruption_ strbehaviour Indicates whether a Spot instance stops or terminates when it is interrupted. Default is
terminate.- instance_
pools_ floatto_ use_ count The number of Spot pools across which to allocate your target Spot capacity. Valid only when
allocation_strategyis set tolowestPrice. Spot Fleet selects the cheapest Spot pools and evenly allocates your target Spot capacity across the number of Spot pools that you specify.- launch_
specifications List[SpotFleet Request Launch Specification] Used to define the launch configuration of the spot-fleet request. Can be specified multiple times to define different bids across different markets and instance types. Conflicts with
launch_template_config. At least one oflaunch_specificationorlaunch_template_configis required.- launch_
template_ List[Spotconfigs Fleet Request Launch Template Config] Launch template configuration block. See Launch Template Configs below for more details. Conflicts with
launch_specification. At least one oflaunch_specificationorlaunch_template_configis required.- load_
balancers List[str] A list of elastic load balancer names to add to the Spot fleet.
- replace_
unhealthy_ boolinstances Indicates whether Spot fleet should replace unhealthy instances. Default
false.- spot_
price str The maximum spot bid for this override request.
- Dict[str, str]
A map of tags to assign to the resource.
- target_
group_ List[str]arns A list of
aws.alb.TargetGroupARNs, for use with Application Load Balancing.- terminate_
instances_ boolwith_ expiration Indicates whether running Spot instances should be terminated when the Spot fleet request expires.
- valid_
from str The start date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request immediately.
- valid_
until str The end date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). At this point, no new Spot instance requests are placed or enabled to fulfill the request. Defaults to 24 hours.
- wait_
for_ boolfulfillment If set, this provider will wait for the Spot Request to be fulfilled, and will throw an error if the timeout of 10m is reached.
Outputs
All input properties are implicitly available as output properties. Additionally, the SpotFleetRequest resource produces the following output properties:
- Client
Token string - Id string
- The provider-assigned unique ID for this managed resource.
- Spot
Request stringState The state of the Spot fleet request.
- Client
Token string - Id string
- The provider-assigned unique ID for this managed resource.
- Spot
Request stringState The state of the Spot fleet request.
- client
Token string - id string
- The provider-assigned unique ID for this managed resource.
- spot
Request stringState The state of the Spot fleet request.
- client_
token str - id str
- The provider-assigned unique ID for this managed resource.
- spot_
request_ strstate The state of the Spot fleet request.
Look up an Existing SpotFleetRequest Resource
Get an existing SpotFleetRequest 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?: SpotFleetRequestState, opts?: CustomResourceOptions): SpotFleetRequeststatic get(resource_name, id, opts=None, allocation_strategy=None, client_token=None, excess_capacity_termination_policy=None, fleet_type=None, iam_fleet_role=None, instance_interruption_behaviour=None, instance_pools_to_use_count=None, launch_specifications=None, launch_template_configs=None, load_balancers=None, replace_unhealthy_instances=None, spot_price=None, spot_request_state=None, tags=None, target_capacity=None, target_group_arns=None, terminate_instances_with_expiration=None, valid_from=None, valid_until=None, wait_for_fulfillment=None, __props__=None);func GetSpotFleetRequest(ctx *Context, name string, id IDInput, state *SpotFleetRequestState, opts ...ResourceOption) (*SpotFleetRequest, error)public static SpotFleetRequest Get(string name, Input<string> id, SpotFleetRequestState? 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:
- Allocation
Strategy string Indicates how to allocate the target capacity across the Spot pools specified by the Spot fleet request. The default is
lowestPrice.- Client
Token string - Excess
Capacity stringTermination Policy Indicates whether running Spot instances should be terminated if the target capacity of the Spot fleet request is decreased below the current size of the Spot fleet.
- Fleet
Type string The type of fleet request. Indicates whether the Spot Fleet only requests the target capacity or also attempts to maintain it. Default is
maintain.- Iam
Fleet stringRole Grants the Spot fleet permission to terminate Spot instances on your behalf when you cancel its Spot fleet request using CancelSpotFleetRequests or when the Spot fleet request expires, if you set terminateInstancesWithExpiration.
- Instance
Interruption stringBehaviour Indicates whether a Spot instance stops or terminates when it is interrupted. Default is
terminate.- Instance
Pools intTo Use Count The number of Spot pools across which to allocate your target Spot capacity. Valid only when
allocation_strategyis set tolowestPrice. Spot Fleet selects the cheapest Spot pools and evenly allocates your target Spot capacity across the number of Spot pools that you specify.- Launch
Specifications List<SpotFleet Request Launch Specification Args> Used to define the launch configuration of the spot-fleet request. Can be specified multiple times to define different bids across different markets and instance types. Conflicts with
launch_template_config. At least one oflaunch_specificationorlaunch_template_configis required.- Launch
Template List<SpotConfigs Fleet Request Launch Template Config Args> Launch template configuration block. See Launch Template Configs below for more details. Conflicts with
launch_specification. At least one oflaunch_specificationorlaunch_template_configis required.- Load
Balancers List<string> A list of elastic load balancer names to add to the Spot fleet.
- Replace
Unhealthy boolInstances Indicates whether Spot fleet should replace unhealthy instances. Default
false.- Spot
Price string The maximum spot bid for this override request.
- Spot
Request stringState The state of the Spot fleet request.
- Dictionary<string, string>
A map of tags to assign to the resource.
- Target
Capacity int The number of units to request. You can choose to set the target capacity in terms of instances or a performance characteristic that is important to your application workload, such as vCPUs, memory, or I/O.
- Target
Group List<string>Arns A list of
aws.alb.TargetGroupARNs, for use with Application Load Balancing.- Terminate
Instances boolWith Expiration Indicates whether running Spot instances should be terminated when the Spot fleet request expires.
- Valid
From string The start date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request immediately.
- Valid
Until string The end date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). At this point, no new Spot instance requests are placed or enabled to fulfill the request. Defaults to 24 hours.
- Wait
For boolFulfillment If set, this provider will wait for the Spot Request to be fulfilled, and will throw an error if the timeout of 10m is reached.
- Allocation
Strategy string Indicates how to allocate the target capacity across the Spot pools specified by the Spot fleet request. The default is
lowestPrice.- Client
Token string - Excess
Capacity stringTermination Policy Indicates whether running Spot instances should be terminated if the target capacity of the Spot fleet request is decreased below the current size of the Spot fleet.
- Fleet
Type string The type of fleet request. Indicates whether the Spot Fleet only requests the target capacity or also attempts to maintain it. Default is
maintain.- Iam
Fleet stringRole Grants the Spot fleet permission to terminate Spot instances on your behalf when you cancel its Spot fleet request using CancelSpotFleetRequests or when the Spot fleet request expires, if you set terminateInstancesWithExpiration.
- Instance
Interruption stringBehaviour Indicates whether a Spot instance stops or terminates when it is interrupted. Default is
terminate.- Instance
Pools intTo Use Count The number of Spot pools across which to allocate your target Spot capacity. Valid only when
allocation_strategyis set tolowestPrice. Spot Fleet selects the cheapest Spot pools and evenly allocates your target Spot capacity across the number of Spot pools that you specify.- Launch
Specifications []SpotFleet Request Launch Specification Used to define the launch configuration of the spot-fleet request. Can be specified multiple times to define different bids across different markets and instance types. Conflicts with
launch_template_config. At least one oflaunch_specificationorlaunch_template_configis required.- Launch
Template []SpotConfigs Fleet Request Launch Template Config Launch template configuration block. See Launch Template Configs below for more details. Conflicts with
launch_specification. At least one oflaunch_specificationorlaunch_template_configis required.- Load
Balancers []string A list of elastic load balancer names to add to the Spot fleet.
- Replace
Unhealthy boolInstances Indicates whether Spot fleet should replace unhealthy instances. Default
false.- Spot
Price string The maximum spot bid for this override request.
- Spot
Request stringState The state of the Spot fleet request.
- map[string]string
A map of tags to assign to the resource.
- Target
Capacity int The number of units to request. You can choose to set the target capacity in terms of instances or a performance characteristic that is important to your application workload, such as vCPUs, memory, or I/O.
- Target
Group []stringArns A list of
aws.alb.TargetGroupARNs, for use with Application Load Balancing.- Terminate
Instances boolWith Expiration Indicates whether running Spot instances should be terminated when the Spot fleet request expires.
- Valid
From string The start date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request immediately.
- Valid
Until string The end date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). At this point, no new Spot instance requests are placed or enabled to fulfill the request. Defaults to 24 hours.
- Wait
For boolFulfillment If set, this provider will wait for the Spot Request to be fulfilled, and will throw an error if the timeout of 10m is reached.
- allocation
Strategy string Indicates how to allocate the target capacity across the Spot pools specified by the Spot fleet request. The default is
lowestPrice.- client
Token string - excess
Capacity stringTermination Policy Indicates whether running Spot instances should be terminated if the target capacity of the Spot fleet request is decreased below the current size of the Spot fleet.
- fleet
Type string The type of fleet request. Indicates whether the Spot Fleet only requests the target capacity or also attempts to maintain it. Default is
maintain.- iam
Fleet stringRole Grants the Spot fleet permission to terminate Spot instances on your behalf when you cancel its Spot fleet request using CancelSpotFleetRequests or when the Spot fleet request expires, if you set terminateInstancesWithExpiration.
- instance
Interruption stringBehaviour Indicates whether a Spot instance stops or terminates when it is interrupted. Default is
terminate.- instance
Pools numberTo Use Count The number of Spot pools across which to allocate your target Spot capacity. Valid only when
allocation_strategyis set tolowestPrice. Spot Fleet selects the cheapest Spot pools and evenly allocates your target Spot capacity across the number of Spot pools that you specify.- launch
Specifications SpotFleet Request Launch Specification[] Used to define the launch configuration of the spot-fleet request. Can be specified multiple times to define different bids across different markets and instance types. Conflicts with
launch_template_config. At least one oflaunch_specificationorlaunch_template_configis required.- launch
Template SpotConfigs Fleet Request Launch Template Config[] Launch template configuration block. See Launch Template Configs below for more details. Conflicts with
launch_specification. At least one oflaunch_specificationorlaunch_template_configis required.- load
Balancers string[] A list of elastic load balancer names to add to the Spot fleet.
- replace
Unhealthy booleanInstances Indicates whether Spot fleet should replace unhealthy instances. Default
false.- spot
Price string The maximum spot bid for this override request.
- spot
Request stringState The state of the Spot fleet request.
- {[key: string]: string}
A map of tags to assign to the resource.
- target
Capacity number The number of units to request. You can choose to set the target capacity in terms of instances or a performance characteristic that is important to your application workload, such as vCPUs, memory, or I/O.
- target
Group string[]Arns A list of
aws.alb.TargetGroupARNs, for use with Application Load Balancing.- terminate
Instances booleanWith Expiration Indicates whether running Spot instances should be terminated when the Spot fleet request expires.
- valid
From string The start date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request immediately.
- valid
Until string The end date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). At this point, no new Spot instance requests are placed or enabled to fulfill the request. Defaults to 24 hours.
- wait
For booleanFulfillment If set, this provider will wait for the Spot Request to be fulfilled, and will throw an error if the timeout of 10m is reached.
- allocation_
strategy str Indicates how to allocate the target capacity across the Spot pools specified by the Spot fleet request. The default is
lowestPrice.- client_
token str - excess_
capacity_ strtermination_ policy Indicates whether running Spot instances should be terminated if the target capacity of the Spot fleet request is decreased below the current size of the Spot fleet.
- fleet_
type str The type of fleet request. Indicates whether the Spot Fleet only requests the target capacity or also attempts to maintain it. Default is
maintain.- iam_
fleet_ strrole Grants the Spot fleet permission to terminate Spot instances on your behalf when you cancel its Spot fleet request using CancelSpotFleetRequests or when the Spot fleet request expires, if you set terminateInstancesWithExpiration.
- instance_
interruption_ strbehaviour Indicates whether a Spot instance stops or terminates when it is interrupted. Default is
terminate.- instance_
pools_ floatto_ use_ count The number of Spot pools across which to allocate your target Spot capacity. Valid only when
allocation_strategyis set tolowestPrice. Spot Fleet selects the cheapest Spot pools and evenly allocates your target Spot capacity across the number of Spot pools that you specify.- launch_
specifications List[SpotFleet Request Launch Specification] Used to define the launch configuration of the spot-fleet request. Can be specified multiple times to define different bids across different markets and instance types. Conflicts with
launch_template_config. At least one oflaunch_specificationorlaunch_template_configis required.- launch_
template_ List[Spotconfigs Fleet Request Launch Template Config] Launch template configuration block. See Launch Template Configs below for more details. Conflicts with
launch_specification. At least one oflaunch_specificationorlaunch_template_configis required.- load_
balancers List[str] A list of elastic load balancer names to add to the Spot fleet.
- replace_
unhealthy_ boolinstances Indicates whether Spot fleet should replace unhealthy instances. Default
false.- spot_
price str The maximum spot bid for this override request.
- spot_
request_ strstate The state of the Spot fleet request.
- Dict[str, str]
A map of tags to assign to the resource.
- target_
capacity float The number of units to request. You can choose to set the target capacity in terms of instances or a performance characteristic that is important to your application workload, such as vCPUs, memory, or I/O.
- target_
group_ List[str]arns A list of
aws.alb.TargetGroupARNs, for use with Application Load Balancing.- terminate_
instances_ boolwith_ expiration Indicates whether running Spot instances should be terminated when the Spot fleet request expires.
- valid_
from str The start date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request immediately.
- valid_
until str The end date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ). At this point, no new Spot instance requests are placed or enabled to fulfill the request. Defaults to 24 hours.
- wait_
for_ boolfulfillment If set, this provider will wait for the Spot Request to be fulfilled, and will throw an error if the timeout of 10m is reached.
Supporting Types
SpotFleetRequestLaunchSpecification
- Ami string
- Instance
Type string The type of instance to request.
- Associate
Public boolIp Address - Availability
Zone string The availability zone in which to place the request.
- Ebs
Block List<SpotDevices Fleet Request Launch Specification Ebs Block Device Args> - Ebs
Optimized bool - Ephemeral
Block List<SpotDevices Fleet Request Launch Specification Ephemeral Block Device Args> - Iam
Instance stringProfile - Iam
Instance stringProfile Arn - Key
Name string - Monitoring bool
- Placement
Group string - Placement
Tenancy string - Root
Block List<SpotDevices Fleet Request Launch Specification Root Block Device Args> - Spot
Price string The maximum spot bid for this override request.
- Subnet
Id string The subnet in which to launch the requested instance.
- Dictionary<string, string>
A map of tags to assign to the resource.
- User
Data string - Vpc
Security List<string>Group Ids - Weighted
Capacity string The capacity added to the fleet by a fulfilled request.
- Ami string
- Instance
Type string The type of instance to request.
- Associate
Public boolIp Address - Availability
Zone string The availability zone in which to place the request.
- Ebs
Block []SpotDevices Fleet Request Launch Specification Ebs Block Device - Ebs
Optimized bool - Ephemeral
Block []SpotDevices Fleet Request Launch Specification Ephemeral Block Device - Iam
Instance stringProfile - Iam
Instance stringProfile Arn - Key
Name string - Monitoring bool
- Placement
Group string - Placement
Tenancy string - Root
Block []SpotDevices Fleet Request Launch Specification Root Block Device - Spot
Price string The maximum spot bid for this override request.
- Subnet
Id string The subnet in which to launch the requested instance.
- map[string]string
A map of tags to assign to the resource.
- User
Data string - Vpc
Security []stringGroup Ids - Weighted
Capacity string The capacity added to the fleet by a fulfilled request.
- ami string
- instance
Type string The type of instance to request.
- associate
Public booleanIp Address - availability
Zone string The availability zone in which to place the request.
- ebs
Block SpotDevices Fleet Request Launch Specification Ebs Block Device[] - ebs
Optimized boolean - ephemeral
Block SpotDevices Fleet Request Launch Specification Ephemeral Block Device[] - iam
Instance stringProfile - iam
Instance stringProfile Arn - key
Name string - monitoring boolean
- placement
Group string - placement
Tenancy string - root
Block SpotDevices Fleet Request Launch Specification Root Block Device[] - spot
Price string The maximum spot bid for this override request.
- subnet
Id string The subnet in which to launch the requested instance.
- {[key: string]: string}
A map of tags to assign to the resource.
- user
Data string - vpc
Security string[]Group Ids - weighted
Capacity string The capacity added to the fleet by a fulfilled request.
- ami str
- instance_
type str The type of instance to request.
- associate_
public_ boolip_ address - availability_
zone str The availability zone in which to place the request.
- ebs_
block_ List[Spotdevices Fleet Request Launch Specification Ebs Block Device] - ebs_
optimized bool - ephemeral_
block_ List[Spotdevices Fleet Request Launch Specification Ephemeral Block Device] - iam
Instance strProfile Arn - iam_
instance_ strprofile - key_
name str - monitoring bool
- placement_
group str - placement_
tenancy str - root_
block_ List[Spotdevices Fleet Request Launch Specification Root Block Device] - spot_
price str The maximum spot bid for this override request.
- subnet_
id str The subnet in which to launch the requested instance.
- Dict[str, str]
A map of tags to assign to the resource.
- user_
data str - vpc_
security_ List[str]group_ ids - weighted
Capacity str The capacity added to the fleet by a fulfilled request.
SpotFleetRequestLaunchSpecificationEbsBlockDevice
SpotFleetRequestLaunchSpecificationEphemeralBlockDevice
SpotFleetRequestLaunchSpecificationRootBlockDevice
SpotFleetRequestLaunchTemplateConfig
- Launch
Template SpotSpecification Fleet Request Launch Template Config Launch Template Specification Args Launch template specification. See Launch Template Specification below for more details.
- Overrides
List<Spot
Fleet Request Launch Template Config Override Args> One or more override configurations. See Overrides below for more details.
- Launch
Template SpotSpecification Fleet Request Launch Template Config Launch Template Specification Launch template specification. See Launch Template Specification below for more details.
- Overrides
[]Spot
Fleet Request Launch Template Config Override One or more override configurations. See Overrides below for more details.
- launch
Template SpotSpecification Fleet Request Launch Template Config Launch Template Specification Launch template specification. See Launch Template Specification below for more details.
- overrides
Spot
Fleet Request Launch Template Config Override[] One or more override configurations. See Overrides below for more details.
- launch
Template Dict[SpotSpecification Fleet Request Launch Template Config Launch Template Specification] Launch template specification. See Launch Template Specification below for more details.
- overrides
List[Spot
Fleet Request Launch Template Config Override] One or more override configurations. See Overrides below for more details.
SpotFleetRequestLaunchTemplateConfigLaunchTemplateSpecification
- Id string
The ID of the launch template. Conflicts with
name.- Name string
The name of the launch template. Conflicts with
id.- Version string
Template version. Unlike the autoscaling equivalent, does not support
$Latestor$Default, so use the launch_template resource’s attribute, e.g."${aws_launch_template.foo.latest_version}". It will use the default version if omitted.
- Id string
The ID of the launch template. Conflicts with
name.- Name string
The name of the launch template. Conflicts with
id.- Version string
Template version. Unlike the autoscaling equivalent, does not support
$Latestor$Default, so use the launch_template resource’s attribute, e.g."${aws_launch_template.foo.latest_version}". It will use the default version if omitted.
- id string
The ID of the launch template. Conflicts with
name.- name string
The name of the launch template. Conflicts with
id.- version string
Template version. Unlike the autoscaling equivalent, does not support
$Latestor$Default, so use the launch_template resource’s attribute, e.g."${aws_launch_template.foo.latest_version}". It will use the default version if omitted.
- id str
The ID of the launch template. Conflicts with
name.- name str
The name of the launch template. Conflicts with
id.- version str
Template version. Unlike the autoscaling equivalent, does not support
$Latestor$Default, so use the launch_template resource’s attribute, e.g."${aws_launch_template.foo.latest_version}". It will use the default version if omitted.
SpotFleetRequestLaunchTemplateConfigOverride
- Availability
Zone string The availability zone in which to place the request.
- Instance
Type string The type of instance to request.
- Priority double
The priority for the launch template override. The lower the number, the higher the priority. If no number is set, the launch template override has the lowest priority.
- Spot
Price string The maximum spot bid for this override request.
- Subnet
Id string The subnet in which to launch the requested instance.
- Weighted
Capacity double The capacity added to the fleet by a fulfilled request.
- Availability
Zone string The availability zone in which to place the request.
- Instance
Type string The type of instance to request.
- Priority float64
The priority for the launch template override. The lower the number, the higher the priority. If no number is set, the launch template override has the lowest priority.
- Spot
Price string The maximum spot bid for this override request.
- Subnet
Id string The subnet in which to launch the requested instance.
- Weighted
Capacity float64 The capacity added to the fleet by a fulfilled request.
- availability
Zone string The availability zone in which to place the request.
- instance
Type string The type of instance to request.
- priority number
The priority for the launch template override. The lower the number, the higher the priority. If no number is set, the launch template override has the lowest priority.
- spot
Price string The maximum spot bid for this override request.
- subnet
Id string The subnet in which to launch the requested instance.
- weighted
Capacity number The capacity added to the fleet by a fulfilled request.
- availability_
zone str The availability zone in which to place the request.
- instance_
type str The type of instance to request.
- priority float
The priority for the launch template override. The lower the number, the higher the priority. If no number is set, the launch template override has the lowest priority.
- spot_
price str The maximum spot bid for this override request.
- subnet_
id str The subnet in which to launch the requested instance.
- weighted
Capacity float The capacity added to the fleet by a fulfilled request.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.