AWS Tools for Windows PowerShell
Command Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Synopsis

Calls the Amazon Elastic Compute Cloud RequestSpotFleet API operation.

Syntax

Request-EC2SpotFleet
-SpotFleetRequestConfig_SpotPrice <String>
-SpotFleetRequestConfig_AllocationStrategy <AllocationStrategy>
-ClassicLoadBalancersConfig_ClassicLoadBalancer <ClassicLoadBalancer[]>
-SpotFleetRequestConfig_ClientToken <String>
-SpotFleetRequestConfig_ExcessCapacityTerminationPolicy <ExcessCapacityTerminationPolicy>
-SpotFleetRequestConfig_FulfilledCapacity <Double>
-SpotFleetRequestConfig_IamFleetRole <String>
-SpotFleetRequestConfig_InstanceInterruptionBehavior <InstanceInterruptionBehavior>
-SpotFleetRequestConfig_InstancePoolsToUseCount <Int32>
-SpotFleetRequestConfig_LaunchSpecification <SpotFleetLaunchSpecification[]>
-SpotFleetRequestConfig_LaunchTemplateConfig <LaunchTemplateConfig[]>
-SpotFleetRequestConfig_OnDemandAllocationStrategy <OnDemandAllocationStrategy>
-SpotFleetRequestConfig_OnDemandFulfilledCapacity <Double>
-SpotFleetRequestConfig_OnDemandMaxTotalPrice <String>
-SpotFleetRequestConfig_OnDemandTargetCapacity <Int32>
-SpotFleetRequestConfig_ReplaceUnhealthyInstance <Boolean>
-SpotFleetRequestConfig_SpotMaxTotalPrice <String>
-SpotFleetRequestConfig_TargetCapacity <Int32>
-TargetGroupsConfig_TargetGroup <TargetGroup[]>
-SpotFleetRequestConfig_TerminateInstancesWithExpiration <Boolean>
-SpotFleetRequestConfig_Type <FleetType>
-SpotFleetRequestConfig_UtcValidFrom <DateTime>
-SpotFleetRequestConfig_UtcValidUntil <DateTime>
-SpotFleetRequestConfig_ValidFrom <DateTime>
-SpotFleetRequestConfig_ValidUntil <DateTime>
-PassThru <SwitchParameter>
-Force <SwitchParameter>

Description

Creates a Spot Fleet request. The Spot Fleet request specifies the total target capacity and the On-Demand target capacity. Amazon EC2 calculates the difference between the total capacity and On-Demand capacity, and launches the difference as Spot capacity. You can submit a single request that includes multiple launch specifications that vary by instance type, AMI, Availability Zone, or subnet. By default, the Spot Fleet requests Spot Instances in the Spot Instance pool where the price per unit is the lowest. Each launch specification can include its own instance weighting that reflects the value of the instance type to your application workload. Alternatively, you can specify that the Spot Fleet distribute the target capacity across the Spot pools included in its launch specifications. By ensuring that the Spot Instances in your Spot Fleet are in different Spot pools, you can improve the availability of your fleet. You can specify tags for the Spot Instances. You cannot tag other resource types in a Spot Fleet request because only the instance resource type is supported. For more information, see Spot Fleet Requests in the Amazon EC2 User Guide for Linux Instances.

Parameters

-ClassicLoadBalancersConfig_ClassicLoadBalancer <ClassicLoadBalancer[]>
One or more Classic Load Balancers.
Required?False
Position?Named
Accept pipeline input?False
AliasesSpotFleetRequestConfig_LoadBalancersConfig_ClassicLoadBalancersConfig_ClassicLoadBalancers
-Force <SwitchParameter>
This parameter overrides confirmation prompts to force the cmdlet to continue its operation. This parameter should always be used with caution.
Required?False
Position?Named
Accept pipeline input?False
-PassThru <SwitchParameter>
Returns the value passed to the SpotFleetRequestConfig_SpotPrice parameter. By default, this cmdlet does not generate any output.
Required?False
Position?Named
Accept pipeline input?False
-SpotFleetRequestConfig_AllocationStrategy <AllocationStrategy>
Indicates how to allocate the target Spot Instance capacity across the Spot Instance pools specified by the Spot Fleet request.If the allocation strategy is lowestPrice, Spot Fleet launches instances from the Spot Instance pools with the lowest price. This is the default allocation strategy.If the allocation strategy is diversified, Spot Fleet launches instances from all the Spot Instance pools that you specify.If the allocation strategy is capacityOptimized, Spot Fleet launches instances from Spot Instance pools with optimal capacity for the number of instances that are launching.
Required?False
Position?Named
Accept pipeline input?False
-SpotFleetRequestConfig_ClientToken <String>
A unique, case-sensitive identifier that you provide to ensure the idempotency of your listings. This helps to avoid duplicate listings. For more information, see Ensuring Idempotency.
Required?False
Position?Named
Accept pipeline input?False
-SpotFleetRequestConfig_ExcessCapacityTerminationPolicy <ExcessCapacityTerminationPolicy>
Indicates whether running Spot Instances should be terminated if you decrease the target capacity of the Spot Fleet request below the current size of the Spot Fleet.
Required?False
Position?Named
Accept pipeline input?False
-SpotFleetRequestConfig_FulfilledCapacity <Double>
The number of units fulfilled by this request compared to the set target capacity. You cannot set this value.
Required?False
Position?Named
Accept pipeline input?False
-SpotFleetRequestConfig_IamFleetRole <String>
The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM) role that grants the Spot Fleet the permission to request, launch, terminate, and tag instances on your behalf. For more information, see Spot Fleet Prerequisites in the Amazon EC2 User Guide for Linux Instances. Spot Fleet can 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.
Required?False
Position?Named
Accept pipeline input?False
-SpotFleetRequestConfig_InstanceInterruptionBehavior <InstanceInterruptionBehavior>
The behavior when a Spot Instance is interrupted. The default is terminate.
Required?False
Position?Named
Accept pipeline input?False
-SpotFleetRequestConfig_InstancePoolsToUseCount <Int32>
The number of Spot pools across which to allocate your target Spot capacity. Valid only when Spot AllocationStrategy is set to lowest-price. Spot Fleet selects the cheapest Spot pools and evenly allocates your target Spot capacity across the number of Spot pools that you specify.
Required?False
Position?Named
Accept pipeline input?False
-SpotFleetRequestConfig_LaunchSpecification <SpotFleetLaunchSpecification[]>
The launch specifications for the Spot Fleet request. If you specify LaunchSpecifications, you can't specify LaunchTemplateConfigs. If you include On-Demand capacity in your request, you must use LaunchTemplateConfigs.
Required?False
Position?Named
Accept pipeline input?False
AliasesSpotFleetRequestConfig_LaunchSpecifications
-SpotFleetRequestConfig_LaunchTemplateConfig <LaunchTemplateConfig[]>
The launch template and overrides. If you specify LaunchTemplateConfigs, you can't specify LaunchSpecifications. If you include On-Demand capacity in your request, you must use LaunchTemplateConfigs.
Required?False
Position?Named
Accept pipeline input?False
AliasesSpotFleetRequestConfig_LaunchTemplateConfigs
-SpotFleetRequestConfig_OnDemandAllocationStrategy <OnDemandAllocationStrategy>
The order of the launch template overrides to use in fulfilling On-Demand capacity. If you specify lowestPrice, Spot Fleet uses price to determine the order, launching the lowest price first. If you specify prioritized, Spot Fleet uses the priority that you assign to each Spot Fleet launch template override, launching the highest priority first. If you do not specify a value, Spot Fleet defaults to lowestPrice.
Required?False
Position?Named
Accept pipeline input?False
-SpotFleetRequestConfig_OnDemandFulfilledCapacity <Double>
The number of On-Demand units fulfilled by this request compared to the set target On-Demand capacity.
Required?False
Position?Named
Accept pipeline input?False
-SpotFleetRequestConfig_OnDemandMaxTotalPrice <String>
The maximum amount per hour for On-Demand Instances that you're willing to pay. You can use the onDemandMaxTotalPrice parameter, the spotMaxTotalPrice parameter, or both parameters to ensure that your fleet cost does not exceed your budget. If you set a maximum price per hour for the On-Demand Instances and Spot Instances in your request, Spot Fleet will launch instances until it reaches the maximum amount you're willing to pay. When the maximum amount you're willing to pay is reached, the fleet stops launching instances even if it hasn’t met the target capacity.
Required?False
Position?Named
Accept pipeline input?False
-SpotFleetRequestConfig_OnDemandTargetCapacity <Int32>
The number of On-Demand 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. If the request type is maintain, you can specify a target capacity of 0 and add capacity later.
Required?False
Position?Named
Accept pipeline input?False
-SpotFleetRequestConfig_ReplaceUnhealthyInstance <Boolean>
Indicates whether Spot Fleet should replace unhealthy instances.
Required?False
Position?Named
Accept pipeline input?False
AliasesSpotFleetRequestConfig_ReplaceUnhealthyInstances
-SpotFleetRequestConfig_SpotMaxTotalPrice <String>
The maximum amount per hour for Spot Instances that you're willing to pay. You can use the spotdMaxTotalPrice parameter, the onDemandMaxTotalPrice parameter, or both parameters to ensure that your fleet cost does not exceed your budget. If you set a maximum price per hour for the On-Demand Instances and Spot Instances in your request, Spot Fleet will launch instances until it reaches the maximum amount you're willing to pay. When the maximum amount you're willing to pay is reached, the fleet stops launching instances even if it hasn’t met the target capacity.
Required?False
Position?Named
Accept pipeline input?False
-SpotFleetRequestConfig_SpotPrice <String>
The maximum price per unit hour that you are willing to pay for a Spot Instance. The default is the On-Demand price.
Required?False
Position?1
Accept pipeline input?True (ByValue, )
-SpotFleetRequestConfig_TargetCapacity <Int32>
The number of units to request for the Spot Fleet. 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. If the request type is maintain, you can specify a target capacity of 0 and add capacity later.
Required?False
Position?Named
Accept pipeline input?False
-SpotFleetRequestConfig_TerminateInstancesWithExpiration <Boolean>
Indicates whether running Spot Instances are terminated when the Spot Fleet request expires.
Required?False
Position?Named
Accept pipeline input?False
-SpotFleetRequestConfig_Type <FleetType>
The type of request. Indicates whether the Spot Fleet only requests the target capacity or also attempts to maintain it. When this value is request, the Spot Fleet only places the required requests. It does not attempt to replenish Spot Instances if capacity is diminished, nor does it submit requests in alternative Spot pools if capacity is not available. When this value is maintain, the Spot Fleet maintains the target capacity. The Spot Fleet places the required requests to meet capacity and automatically replenishes any interrupted instances. Default: maintain. instant is listed but is not used by Spot Fleet.
Required?False
Position?Named
Accept pipeline input?False
-SpotFleetRequestConfig_UtcValidFrom <DateTime>
The start date and time of the request, in UTC format (YYYY-MM-DDTHH:MM:SSZ). By default, Amazon EC2 starts fulfilling the request immediately.
Required?False
Position?Named
Accept pipeline input?False
-SpotFleetRequestConfig_UtcValidUntil <DateTime>
The end date and time of the request, in UTC format (YYYY-MM-DDTHH:MM:SSZ). After the end date and time, no new Spot Instance requests are placed or able to fulfill the request. If no value is specified, the Spot Fleet request remains until you cancel it.
Required?False
Position?Named
Accept pipeline input?False
-SpotFleetRequestConfig_ValidFrom <DateTime>
This property is deprecated. Setting this property results in non-UTC DateTimes not being marshalled correctly. Use ValidFromUtc instead. Setting either ValidFrom or ValidFromUtc results in both ValidFrom and ValidFromUtc being assigned, the latest assignment to either one of the two property is reflected in the value of both. ValidFrom is provided for backwards compatibility only and assigning a non-Utc DateTime to it results in the wrong timestamp being passed to the service.The start date and time of the request, in UTC format (YYYY-MM-DDTHH:MM:SSZ). By default, Amazon EC2 starts fulfilling the request immediately.This parameter is deprecated.
Required?False
Position?Named
Accept pipeline input?False
-SpotFleetRequestConfig_ValidUntil <DateTime>
This property is deprecated. Setting this property results in non-UTC DateTimes not being marshalled correctly. Use ValidUntilUtc instead. Setting either ValidUntil or ValidUntilUtc results in both ValidUntil and ValidUntilUtc being assigned, the latest assignment to either one of the two property is reflected in the value of both. ValidUntil is provided for backwards compatibility only and assigning a non-Utc DateTime to it results in the wrong timestamp being passed to the service.The end date and time of the request, in UTC format (YYYY-MM-DDTHH:MM:SSZ). After the end date and time, no new Spot Instance requests are placed or able to fulfill the request. If no value is specified, the Spot Fleet request remains until you cancel it.This parameter is deprecated.
Required?False
Position?Named
Accept pipeline input?False
-TargetGroupsConfig_TargetGroup <TargetGroup[]>
One or more target groups.
Required?False
Position?Named
Accept pipeline input?False
AliasesSpotFleetRequestConfig_LoadBalancersConfig_TargetGroupsConfig_TargetGroups

Common Credential and Region Parameters

-AccessKey <String>
The AWS access key for the user account. This can be a temporary access key if the corresponding session token is supplied to the -SessionToken parameter.
Required? False
Position? Named
Accept pipeline input? False
Aliases AK
-Credential <AWSCredentials>
An AWSCredentials object instance containing access and secret key information, and optionally a token for session-based credentials.
Required? False
Position? Named
Accept pipeline input? False
-ProfileLocation <String>

Used to specify the name and location of the ini-format credential file (shared with the AWS CLI and other AWS SDKs)

If this optional parameter is omitted this cmdlet will search the encrypted credential file used by the AWS SDK for .NET and AWS Toolkit for Visual Studio first. If the profile is not found then the cmdlet will search in the ini-format credential file at the default location: (user's home directory)\.aws\credentials. Note that the encrypted credential file is not supported on all platforms. It will be skipped when searching for profiles on Windows Nano Server, Mac, and Linux platforms.

If this parameter is specified then this cmdlet will only search the ini-format credential file at the location given.

As the current folder can vary in a shell or during script execution it is advised that you use specify a fully qualified path instead of a relative path.

Required? False
Position? Named
Accept pipeline input? False
Aliases AWSProfilesLocation, ProfilesLocation
-ProfileName <String>
The user-defined name of an AWS credentials or SAML-based role profile containing credential information. The profile is expected to be found in the secure credential file shared with the AWS SDK for .NET and AWS Toolkit for Visual Studio. You can also specify the name of a profile stored in the .ini-format credential file used with the AWS CLI and other AWS SDKs.
Required? False
Position? Named
Accept pipeline input? False
Aliases AWSProfileName, StoredCredentials
-NetworkCredential <PSCredential>
Used with SAML-based authentication when ProfileName references a SAML role profile. Contains the network credentials to be supplied during authentication with the configured identity provider's endpoint. This parameter is not required if the user's default network identity can or should be used during authentication.
Required? False
Position? Named
Accept pipeline input? False
-SecretKey <String>
The AWS secret key for the user account. This can be a temporary secret key if the corresponding session token is supplied to the -SessionToken parameter.
Required? False
Position? Named
Accept pipeline input? False
Aliases SecretAccessKey, SK
-SessionToken <String>
The session token if the access and secret keys are temporary session-based credentials.
Required? False
Position? Named
Accept pipeline input? False
Aliases ST
-Region <String>
The system name of the AWS region in which the operation should be invoked. For example, us-east-1, eu-west-1 etc.
Required? False
Position? Named
Accept pipeline input? False
Aliases RegionToCall
-EndpointUrl <String>

The endpoint to make the call against.

Note: This parameter is primarily for internal AWS use and is not required/should not be specified for normal usage. The cmdlets normally determine which endpoint to call based on the region specified to the -Region parameter or set as default in the shell (via Set-DefaultAWSRegion). Only specify this parameter if you must direct the call to a specific custom endpoint.

Required? False
Position? Named
Accept pipeline input? False

Inputs

You can pipe a String object to this cmdlet for the SpotFleetRequestConfig_SpotPrice parameter.

Outputs

None or System.String
When you use the PassThru parameter, this cmdlet outputs the value supplied to the SpotFleetRequestConfig_SpotPrice parameter. Otherwise, this cmdlet does not return any output. The service response (type Amazon.EC2.Model.RequestSpotFleetResponse) can be referenced from properties attached to the cmdlet entry in the $AWSHistory stack.

Examples

Example 1

PS C:\> $sg = New-Object Amazon.EC2.Model.GroupIdentifier
PS C:\> $sg.GroupId = "sg-12345678"
PS C:\> $lc = New-Object Amazon.EC2.Model.SpotFleetLaunchSpecification
PS C:\> $lc.ImageId = "ami-12345678"
PS C:\> $lc.InstanceType = "m3.medium"
PS C:\> $lc.SecurityGroups.Add($sg)
PS C:\> Request-EC2SpotFleet -SpotFleetRequestConfig_SpotPrice 0.04 `
-SpotFleetRequestConfig_TargetCapacity 2 `
-SpotFleetRequestConfig_IamFleetRole arn:aws:iam::123456789012:role/my-spot-fleet-role `
-SpotFleetRequestConfig_LaunchSpecification $lc
This example creates a Spot fleet request in the Availability Zone with the lowest price for the specified instance type. If your account supports EC2-VPC only, the Spot fleet launches the instances in the lowest-priced Availability Zone that has a default subnet. If your account supports EC2-Classic, the Spot fleet launches the instances in EC2-Classic in the lowest-priced Availability Zone. Note that the price you pay will not exceed the specified Spot price for the request.

Supported Version

AWS Tools for PowerShell: 2.x.y.z