Show / Hide Table of Contents

Class 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",
                RootBlockDevice = 
                {

                    {
                        { "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 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",
    });
}

}
Inheritance
System.Object
Resource
CustomResource
SpotFleetRequest
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Aws.Ec2
Assembly: Pulumi.Aws.dll
Syntax
public class SpotFleetRequest : CustomResource

Constructors

View Source

SpotFleetRequest(String, SpotFleetRequestArgs, CustomResourceOptions)

Create a SpotFleetRequest resource with the given unique name, arguments, and options.

Declaration
public SpotFleetRequest(string name, SpotFleetRequestArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

SpotFleetRequestArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

AllocationStrategy

Indicates how to allocate the target capacity across the Spot pools specified by the Spot fleet request. The default is lowestPrice.

Declaration
public Output<string> AllocationStrategy { get; }
Property Value
Type Description
Output<System.String>
View Source

ClientToken

Declaration
public Output<string> ClientToken { get; }
Property Value
Type Description
Output<System.String>
View Source

ExcessCapacityTerminationPolicy

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.

Declaration
public Output<string> ExcessCapacityTerminationPolicy { get; }
Property Value
Type Description
Output<System.String>
View Source

FleetType

The type of fleet request. Indicates whether the Spot Fleet only requests the target capacity or also attempts to maintain it. Default is maintain.

Declaration
public Output<string> FleetType { get; }
Property Value
Type Description
Output<System.String>
View Source

IamFleetRole

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.

Declaration
public Output<string> IamFleetRole { get; }
Property Value
Type Description
Output<System.String>
View Source

InstanceInterruptionBehaviour

Indicates whether a Spot instance stops or terminates when it is interrupted. Default is terminate.

Declaration
public Output<string> InstanceInterruptionBehaviour { get; }
Property Value
Type Description
Output<System.String>
View Source

InstancePoolsToUseCount

The number of Spot pools across which to allocate your target Spot capacity. Valid only when allocation_strategy is set to lowestPrice. Spot Fleet selects the cheapest Spot pools and evenly allocates your target Spot capacity across the number of Spot pools that you specify.

Declaration
public Output<int?> InstancePoolsToUseCount { get; }
Property Value
Type Description
Output<System.Nullable<System.Int32>>
View Source

LaunchSpecifications

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 of launch_specification or launch_template_config is required.

Declaration
public Output<ImmutableArray<SpotFleetRequestLaunchSpecification>> LaunchSpecifications { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<SpotFleetRequestLaunchSpecification>>
View Source

LaunchTemplateConfigs

Launch template configuration block. See Launch Template Configs below for more details. Conflicts with launch_specification. At least one of launch_specification or launch_template_config is required.

Declaration
public Output<ImmutableArray<SpotFleetRequestLaunchTemplateConfig>> LaunchTemplateConfigs { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<SpotFleetRequestLaunchTemplateConfig>>
View Source

LoadBalancers

A list of elastic load balancer names to add to the Spot fleet.

Declaration
public Output<ImmutableArray<string>> LoadBalancers { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

ReplaceUnhealthyInstances

Indicates whether Spot fleet should replace unhealthy instances. Default false.

Declaration
public Output<bool?> ReplaceUnhealthyInstances { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

SpotPrice

The maximum spot bid for this override request.

Declaration
public Output<string> SpotPrice { get; }
Property Value
Type Description
Output<System.String>
View Source

SpotRequestState

The state of the Spot fleet request.

Declaration
public Output<string> SpotRequestState { get; }
Property Value
Type Description
Output<System.String>
View Source

Tags

A map of tags to assign to the resource.

Declaration
public Output<ImmutableDictionary<string, object>> Tags { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.Object>>
View Source

TargetCapacity

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.

Declaration
public Output<int> TargetCapacity { get; }
Property Value
Type Description
Output<System.Int32>
View Source

TargetGroupArns

A list of aws.alb.TargetGroup ARNs, for use with Application Load Balancing.

Declaration
public Output<ImmutableArray<string>> TargetGroupArns { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

TerminateInstancesWithExpiration

Indicates whether running Spot instances should be terminated when the Spot fleet request expires.

Declaration
public Output<bool?> TerminateInstancesWithExpiration { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

ValidFrom

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.

Declaration
public Output<string> ValidFrom { get; }
Property Value
Type Description
Output<System.String>
View Source

ValidUntil

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.

Declaration
public Output<string> ValidUntil { get; }
Property Value
Type Description
Output<System.String>
View Source

WaitForFulfillment

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.

Declaration
public Output<bool?> WaitForFulfillment { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>

Methods

View Source

Get(String, Input<String>, SpotFleetRequestState, CustomResourceOptions)

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

Declaration
public static SpotFleetRequest Get(string name, Input<string> id, SpotFleetRequestState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

SpotFleetRequestState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
SpotFleetRequest
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.