Skip to content

EC2  >  Operations  >  request_spot_fleet

request_spot_fleet

Operation

request_spot_fleet async

request_spot_fleet(input: RequestSpotFleetInput, plugins: list[Plugin] | None = None) -> RequestSpotFleetOutput

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 Fleet request and instances launched by the fleet. You cannot tag other resource types in a Spot Fleet request because only the spot-fleet-request and instance resource types are supported.

For more information, see Spot Fleet requests in the Amazon EC2 User Guide.

Warning

We strongly discourage using the RequestSpotFleet API because it is a legacy API with no planned investment. For options for requesting Spot Instances, see Which is the best Spot request method to use? in the Amazon EC2 User Guide.

Parameters:

Name Type Description Default
input RequestSpotFleetInput

An instance of RequestSpotFleetInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
RequestSpotFleetOutput

An instance of RequestSpotFleetOutput.

Input

RequestSpotFleetInput dataclass

Bases: _SerdeShape

Contains the parameters for RequestSpotFleet.

Attributes

dry_run class-attribute instance-attribute
dry_run: bool | None = ...

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

spot_fleet_request_config class-attribute instance-attribute
spot_fleet_request_config: SpotFleetRequestConfigData | None = ...

The configuration for the Spot Fleet request.

Output

RequestSpotFleetOutput dataclass

Bases: _SerdeShape

Contains the output of RequestSpotFleet.

Attributes

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.

spot_fleet_request_id class-attribute instance-attribute
spot_fleet_request_id: str | None = ...

The ID of the Spot Fleet request.