Table Of Contents

Feedback

User Guide

First time using the AWS CLI? See the User Guide for help getting started.

[ aws . ec2 ]

modify-spot-fleet-request

Description

Modifies the specified Spot Fleet request.

While the Spot Fleet request is being modified, it is in the modifying state.

To scale up your Spot Fleet, increase its target capacity. The Spot Fleet launches the additional Spot Instances according to the allocation strategy for the Spot Fleet request. If the allocation strategy is lowestPrice , the Spot Fleet launches instances using the Spot pool with the lowest price. If the allocation strategy is diversified , the Spot Fleet distributes the instances across the Spot pools.

To scale down your Spot Fleet, decrease its target capacity. First, the Spot Fleet cancels any open requests that exceed the new target capacity. You can request that the Spot Fleet terminate Spot Instances until the size of the fleet no longer exceeds the new target capacity. If the allocation strategy is lowestPrice , the Spot Fleet terminates the instances with the highest price per unit. If the allocation strategy is diversified , the Spot Fleet terminates instances across the Spot pools. Alternatively, you can request that the Spot Fleet keep the fleet at its current size, but not replace any Spot Instances that are interrupted or that you terminate manually.

If you are finished with your Spot Fleet for now, but will use it again later, you can set the target capacity to 0.

See also: AWS API Documentation

Synopsis

  modify-spot-fleet-request
[--excess-capacity-termination-policy <value>]
--spot-fleet-request-id <value>
[--target-capacity <value>]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]

Options

--excess-capacity-termination-policy (string)

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.

Possible values:

  • noTermination
  • default

--spot-fleet-request-id (string)

The ID of the Spot Fleet request.

--target-capacity (integer)

The size of the fleet.

--cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI values will override the JSON-provided values.

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

Examples

To modify a Spot fleet request

This example command updates the target capacity of the specified Spot fleet request.

Command:

aws ec2 modify-spot-fleet-request --target-capacity 20 --spot-fleet-request-id sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE

Output:

{
    "Return": true
}

This example command decreases the target capacity of the specified Spot fleet request without terminating any Spot Instances as a result.

Command:

aws ec2 modify-spot-fleet-request --target-capacity 10 --excess-capacity-termination-policy NoTermination --spot-fleet-request-ids sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE

Output:

{
    "Return": true
}

Output

Return -> (boolean)

Is true if the request succeeds, and an error otherwise.