[ aws . ec2 ]

modify-spot-fleet-request

Description

Modifies the specified Spot Fleet request.

You can only modify a Spot Fleet request of type maintain .

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 Instance pool with the lowest price. If the allocation strategy is diversified , the Spot Fleet distributes the instances across the Spot Instance pools. 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.

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 capacityOptimized , the Spot Fleet terminates the instances in the Spot Instance pools that have the least available Spot Instance capacity. If the allocation strategy is diversified , the Spot Fleet terminates instances across the Spot Instance 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

See ‘aws help’ for descriptions of global parameters.

Synopsis

  modify-spot-fleet-request
[--excess-capacity-termination-policy <value>]
--spot-fleet-request-id <value>
[--target-capacity <value>]
[--on-demand-target-capacity <value>]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
[--cli-auto-prompt <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.

--on-demand-target-capacity (integer)

The number of On-Demand Instances in the fleet.

--cli-input-json | --cli-input-yaml (string) Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, those values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally. This may not be specified along with --cli-input-yaml.

--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. Similarly, if provided yaml-input it will print a sample input YAML that can be used with --cli-input-yaml. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

--cli-auto-prompt (boolean) Automatically prompt for CLI input parameters.

See ‘aws help’ for descriptions of global parameters.

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.