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>

Description

Launches an EC2 Fleet. You can create a single EC2 Fleet that includes 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
-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.
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.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-OnDemandOptions_MinTargetCapacity <Int32>
The minimum target capacity for On-Demand Instances in the fleet. If the minimum target capacity is not reached, the fleet launches no instances.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.lowest-price - EC2 Fleet launches instances from the Spot Instance pools with the lowest price.diversified - EC2 Fleet launches instances from all of the Spot Instance pools that you specify.capacity-optimized (recommended) - EC2 Fleet launches instances from Spot Instance pools with optimal capacity for the number of instances that are launching. 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 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.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.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-SpotOptions_MinTargetCapacity <Int32>
The minimum target capacity for Spot Instances in the fleet. If the minimum target capacity is not reached, the fleet launches no instances.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 Tagging 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 TotalTargetCapacity, which is either Spot or On-Demand.
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.Default: units (translates to number of instances)
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-TargetCapacitySpecification_TotalTargetCapacity <Int32>
The number of units to request, filled using DefaultTargetCapacityType.
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