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 (EC2) CreateFleet API operation.

Syntax

New-EC2Fleet
-LaunchTemplateConfig <FleetLaunchTemplateConfigRequest[]>
-OnDemandOptions_AllocationStrategy <FleetOnDemandAllocationStrategy>
-SpotOptions_AllocationStrategy <SpotAllocationStrategy>
-Context <String>
-TargetCapacitySpecification_DefaultTargetCapacityType <DefaultTargetCapacityType>
-ExcessCapacityTerminationPolicy <FleetExcessCapacityTerminationPolicy>
-SpotOptions_InstanceInterruptionBehavior <SpotInstanceInterruptionBehavior>
-SpotOptions_InstancePoolsToUseCount <Int32>
-OnDemandOptions_MaxTotalPrice <String>
-SpotOptions_MaxTotalPrice <String>
-OnDemandOptions_MinTargetCapacity <Int32>
-SpotOptions_MinTargetCapacity <Int32>
-TargetCapacitySpecification_OnDemandTargetCapacity <Int32>
-CapacityRebalance_ReplacementStrategy <FleetReplacementStrategy>
-ReplaceUnhealthyInstance <Boolean>
-OnDemandOptions_SingleAvailabilityZone <Boolean>
-SpotOptions_SingleAvailabilityZone <Boolean>
-OnDemandOptions_SingleInstanceType <Boolean>
-SpotOptions_SingleInstanceType <Boolean>
-TargetCapacitySpecification_SpotTargetCapacity <Int32>
-TagSpecification <TagSpecification[]>
-TargetCapacitySpecification_TargetCapacityUnitType <TargetCapacityUnitType>
-TerminateInstancesWithExpiration <Boolean>
-CapacityRebalance_TerminationDelay <Int32>
-TargetCapacitySpecification_TotalTargetCapacity <Int32>
-Type <FleetType>
-CapacityReservationOptions_UsageStrategy <FleetCapacityReservationUsageStrategy>
-UtcValidFrom <DateTime>
-UtcValidUntil <DateTime>
-ClientToken <String>
-ValidFrom <DateTime>
-ValidUntil <DateTime>
-Select <String>
-PassThru <SwitchParameter>
-Force <SwitchParameter>
-ClientConfig <AmazonEC2Config>

Description

Creates an EC2 Fleet that contains the configuration information for On-Demand Instances and Spot Instances. Instances are launched immediately if there is available capacity. A single EC2 Fleet can include multiple launch specifications that vary by instance type, AMI, Availability Zone, or subnet. For more information, see EC2 Fleet in the Amazon EC2 User Guide.

Parameters

-CapacityRebalance_ReplacementStrategy <FleetReplacementStrategy>
The replacement strategy to use. Only available for fleets of type maintain.launch - EC2 Fleet launches a replacement Spot Instance when a rebalance notification is emitted for an existing Spot Instance in the fleet. EC2 Fleet does not terminate the instances that receive a rebalance notification. You can terminate the old instances, or you can leave them running. You are charged for all instances while they are running.launch-before-terminate - EC2 Fleet launches a replacement Spot Instance when a rebalance notification is emitted for an existing Spot Instance in the fleet, and then, after a delay that you specify (in TerminationDelay), terminates the instances that received a rebalance notification.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesSpotOptions_MaintenanceStrategies_CapacityRebalance_ReplacementStrategy
-CapacityRebalance_TerminationDelay <Int32>
The amount of time (in seconds) that Amazon EC2 waits before terminating the old Spot Instance after launching a new replacement Spot Instance.Required when ReplacementStrategy is set to launch-before-terminate.Not valid when ReplacementStrategy is set to launch.Valid values: Minimum value of 120 seconds. Maximum value of 7200 seconds.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesSpotOptions_MaintenanceStrategies_CapacityRebalance_TerminationDelay
-CapacityReservationOptions_UsageStrategy <FleetCapacityReservationUsageStrategy>
Indicates whether to use unused Capacity Reservations for fulfilling On-Demand capacity.If you specify use-capacity-reservations-first, the fleet uses unused Capacity Reservations to fulfill On-Demand capacity up to the target On-Demand capacity. If multiple instance pools have unused Capacity Reservations, the On-Demand allocation strategy (lowest-price or prioritized) is applied. If the number of unused Capacity Reservations is less than the On-Demand target capacity, the remaining On-Demand target capacity is launched according to the On-Demand allocation strategy (lowest-price or prioritized).If you do not specify a value, the fleet fulfils the On-Demand capacity according to the chosen On-Demand allocation strategy.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesOnDemandOptions_CapacityReservationOptions_UsageStrategy
-ClientConfig <AmazonEC2Config>
Amazon.PowerShell.Cmdlets.EC2.AmazonEC2ClientCmdlet.ClientConfig
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-ClientToken <String>
Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensuring idempotency.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-Context <String>
Reserved.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-ExcessCapacityTerminationPolicy <FleetExcessCapacityTerminationPolicy>
Indicates whether running instances should be terminated if the total target capacity of the EC2 Fleet is decreased below the current size of the EC2 Fleet.Supported only for fleets of type maintain.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
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?True (ByPropertyName)
-LaunchTemplateConfig <FleetLaunchTemplateConfigRequest[]>
The configuration for the EC2 Fleet.
Required?True
Position?1
Accept pipeline input?True (ByValue, ByPropertyName)
AliasesLaunchTemplateConfigs
-OnDemandOptions_AllocationStrategy <FleetOnDemandAllocationStrategy>
The strategy that determines the order of the launch template overrides to use in fulfilling On-Demand capacity.lowest-price - EC2 Fleet uses price to determine the order, launching the lowest price first.prioritized - EC2 Fleet uses the priority that you assigned to each launch template override, launching the highest priority first.Default: lowest-price
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-OnDemandOptions_MaxTotalPrice <String>
The maximum amount per hour for On-Demand Instances that you're willing to pay.If your fleet includes T instances that are configured as unlimited, and if their average CPU usage exceeds the baseline utilization, you will incur a charge for surplus credits. The MaxTotalPrice does not account for surplus credits, and, if you use surplus credits, your final cost might be higher than what you specified for MaxTotalPrice. For more information, see Surplus credits can incur charges in the Amazon EC2 User Guide.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-OnDemandOptions_MinTargetCapacity <Int32>
The minimum target capacity for On-Demand Instances in the fleet. If this minimum capacity isn't reached, no instances are launched.Constraints: Maximum value of 1000. Supported only for fleets of type instant.At least one of the following must be specified: SingleAvailabilityZone | SingleInstanceType
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-OnDemandOptions_SingleAvailabilityZone <Boolean>
Indicates that the fleet launches all On-Demand Instances into a single Availability Zone.Supported only for fleets of type instant.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-OnDemandOptions_SingleInstanceType <Boolean>
Indicates that the fleet uses a single instance type to launch all On-Demand Instances in the fleet.Supported only for fleets of type instant.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-PassThru <SwitchParameter>
Changes the cmdlet behavior to return the value passed to the LaunchTemplateConfig parameter. The -PassThru parameter is deprecated, use -Select '^LaunchTemplateConfig' instead. This parameter will be removed in a future version.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-ReplaceUnhealthyInstance <Boolean>
Indicates whether EC2 Fleet should replace unhealthy Spot Instances. Supported only for fleets of type maintain. For more information, see EC2 Fleet health checks in the Amazon EC2 User Guide.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesReplaceUnhealthyInstances
-Select <String>
Use the -Select parameter to control the cmdlet output. The default value is '*'. Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.EC2.Model.CreateFleetResponse). Specifying the name of a property of type Amazon.EC2.Model.CreateFleetResponse will result in that property being returned. Specifying -Select '^ParameterName' will result in the cmdlet returning the selected cmdlet parameter value.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-SpotOptions_AllocationStrategy <SpotAllocationStrategy>
The strategy that determines how to allocate the target Spot Instance capacity across the Spot Instance pools specified by the EC2 Fleet launch configuration. For more information, see Allocation strategies for Spot Instances in the Amazon EC2 User Guide.
price-capacity-optimized (recommended)
EC2 Fleet identifies the pools with the highest capacity availability for the number of instances that are launching. This means that we will request Spot Instances from the pools that we believe have the lowest chance of interruption in the near term. EC2 Fleet then requests Spot Instances from the lowest priced of these pools.
capacity-optimized
EC2 Fleet identifies the pools with the highest capacity availability for the number of instances that are launching. This means that we will request Spot Instances from the pools that we believe have the lowest chance of interruption in the near term. To give certain instance types a higher chance of launching first, use capacity-optimized-prioritized. Set a priority for each instance type by using the Priority parameter for LaunchTemplateOverrides. You can assign the same priority to different LaunchTemplateOverrides. EC2 implements the priorities on a best-effort basis, but optimizes for capacity first. capacity-optimized-prioritized is supported only if your EC2 Fleet uses a launch template. Note that if the On-Demand AllocationStrategy is set to prioritized, the same priority is applied when fulfilling On-Demand capacity.
diversified
EC2 Fleet requests instances from all of the Spot Instance pools that you specify.
lowest-price (not recommended)
We don't recommend the lowest-price allocation strategy because it has the highest risk of interruption for your Spot Instances.EC2 Fleet requests instances from the lowest priced Spot Instance pool that has available capacity. If the lowest priced pool doesn't have available capacity, the Spot Instances come from the next lowest priced pool that has available capacity. If a pool runs out of capacity before fulfilling your desired capacity, EC2 Fleet will continue to fulfill your request by drawing from the next lowest priced pool. To ensure that your desired capacity is met, you might receive Spot Instances from several pools. Because this strategy only considers instance price and not capacity availability, it might lead to high interruption rates.
Default: lowest-price
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-SpotOptions_InstanceInterruptionBehavior <SpotInstanceInterruptionBehavior>
The behavior when a Spot Instance is interrupted.Default: terminate
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-SpotOptions_InstancePoolsToUseCount <Int32>
The number of Spot pools across which to allocate your target Spot capacity. Supported only when Spot AllocationStrategy is set to lowest-price. EC2 Fleet selects the cheapest Spot pools and evenly allocates your target Spot capacity across the number of Spot pools that you specify.Note that EC2 Fleet attempts to draw Spot Instances from the number of pools that you specify on a best effort basis. If a pool runs out of Spot capacity before fulfilling your target capacity, EC2 Fleet will continue to fulfill your request by drawing from the next cheapest pool. To ensure that your target capacity is met, you might receive Spot Instances from more than the number of pools that you specified. Similarly, if most of the pools have no Spot capacity, you might receive your full target capacity from fewer than the number of pools that you specified.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-SpotOptions_MaxTotalPrice <String>
The maximum amount per hour for Spot Instances that you're willing to pay. We do not recommend using this parameter because it can lead to increased interruptions. If you do not specify this parameter, you will pay the current Spot price.If you specify a maximum price, your Spot Instances will be interrupted more frequently than if you do not specify this parameter.If your fleet includes T instances that are configured as unlimited, and if their average CPU usage exceeds the baseline utilization, you will incur a charge for surplus credits. The MaxTotalPrice does not account for surplus credits, and, if you use surplus credits, your final cost might be higher than what you specified for MaxTotalPrice. For more information, see Surplus credits can incur charges in the Amazon EC2 User Guide.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-SpotOptions_MinTargetCapacity <Int32>
The minimum target capacity for Spot Instances in the fleet. If this minimum capacity isn't reached, no instances are launched.Constraints: Maximum value of 1000. Supported only for fleets of type instant.At least one of the following must be specified: SingleAvailabilityZone | SingleInstanceType
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-SpotOptions_SingleAvailabilityZone <Boolean>
Indicates that the fleet launches all Spot Instances into a single Availability Zone.Supported only for fleets of type instant.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-SpotOptions_SingleInstanceType <Boolean>
Indicates that the fleet uses a single instance type to launch all Spot Instances in the fleet.Supported only for fleets of type instant.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-TagSpecification <TagSpecification[]>
The key-value pair for tagging the EC2 Fleet request on creation. For more information, see Tag your resources.If the fleet type is instant, specify a resource type of fleet to tag the fleet or instance to tag the instances at launch.If the fleet type is maintain or request, specify a resource type of fleet to tag the fleet. You cannot specify a resource type of instance. To tag instances at launch, specify the tags in a launch template.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesTagSpecifications
-TargetCapacitySpecification_DefaultTargetCapacityType <DefaultTargetCapacityType>
The default target capacity type.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-TargetCapacitySpecification_OnDemandTargetCapacity <Int32>
The number of On-Demand units to request.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-TargetCapacitySpecification_SpotTargetCapacity <Int32>
The number of Spot units to request.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-TargetCapacitySpecification_TargetCapacityUnitType <TargetCapacityUnitType>
The unit for the target capacity. You can specify this parameter only when using attributed-based instance type selection.Default: units (the number of instances)
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-TargetCapacitySpecification_TotalTargetCapacity <Int32>
The number of units to request, filled using the default target capacity type.
Required?True
Position?Named
Accept pipeline input?True (ByPropertyName)
-TerminateInstancesWithExpiration <Boolean>
Indicates whether running instances should be terminated when the EC2 Fleet expires.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-Type <FleetType>
The fleet type. The default value is maintain.
  • maintain - The EC2 Fleet places an asynchronous request for your desired capacity, and continues to maintain your desired Spot capacity by replenishing interrupted Spot Instances.
  • request - The EC2 Fleet places an asynchronous one-time request for your desired capacity, but does submit Spot requests in alternative capacity pools if Spot capacity is unavailable, and does not maintain Spot capacity if Spot Instances are interrupted.
  • instant - The EC2 Fleet places a synchronous one-time request for your desired capacity, and returns errors for any instances that could not be launched.
For more information, see EC2 Fleet request types in the Amazon EC2 User Guide.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-UtcValidFrom <DateTime>
The start date and time of the request, in UTC format (for example, YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request immediately.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-UtcValidUntil <DateTime>
The end date and time of the request, in UTC format (for example, YYYY-MM-DDTHH:MM:SSZ). At this point, no new EC2 Fleet requests are placed or able to fulfill the request. If no value is specified, the request remains until you cancel it.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-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 (for example, YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request immediately.This parameter is deprecated.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-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 (for example, YYYY-MM-DDTHH:MM:SSZ). At this point, no new EC2 Fleet requests are placed or able to fulfill the request. If no value is specified, the request remains until you cancel it.This parameter is deprecated.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)

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?True (ByPropertyName)
AliasesAK
-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?True (ByValue, ByPropertyName)
-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?True (ByPropertyName)
-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?True (ByValue, ByPropertyName)
-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.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?True (ByPropertyName)
AliasesAWSProfilesLocation, 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?True (ByPropertyName)
AliasesStoredCredentials, AWSProfileName
-Region <Object>
The system name of an AWS region or an AWSRegion instance. This governs the endpoint that will be used when calling service operations. Note that the AWS resources referenced in a call are usually region-specific.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesRegionToCall
-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?True (ByPropertyName)
AliasesSK, SecretAccessKey
-SessionToken <String>
The session token if the access and secret keys are temporary session-based credentials.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesST

Outputs

This cmdlet returns an Amazon.EC2.Model.CreateFleetResponse object containing multiple properties. The object can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack.

Supported Version

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