Menu
Amazon Elastic Compute Cloud
API Reference (API Version 2016-11-15)

RequestSpotFleet

Creates a Spot fleet request.

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 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.

For more information, see Spot Fleet Requests in the Amazon Elastic Compute Cloud User Guide.

Request Parameters

The following parameters are for this specific action. For more information about required and optional parameters that are common to all actions, see Common Query Parameters.

DryRun

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.

Type: Boolean

Required: No

SpotFleetRequestConfig

The configuration for the Spot fleet request.

Type: SpotFleetRequestConfigData object

Required: Yes

Response Elements

The following elements are returned by the service.

requestId

The ID of the request.

Type: String

spotFleetRequestId

The ID of the Spot fleet request.

Type: String

Errors

For information about the errors that are common to all actions, see Common Client Errors.

Example

Example

This example creates a Spot fleet request with 2 launch specifications.

Sample Request

https://ec2.amazonaws.com/?Action=RequestSpotFleet
&SpotFleetRequestConfig.IamFleetRole=arn:aws:iam::123456789011:role/spot-fleet-role
&SpotFleetRequestConfig.SpotPrice=0.0153
&SpotFleetRequestConfig.TargetCapacity=5
&SpotFleetRequestConfig.LaunchSpecifications.1.ImageId=ami-1ecae776
&SpotFleetRequestConfig.LaunchSpecifications.1.InstanceType=m4.large
&SpotFleetRequestConfig.LaunchSpecifications.1.SubnetId=subnet-1a2b3c4d
&SpotFleetRequestConfig.LaunchSpecifications.2.ImageId=ami-1ecae776
&SpotFleetRequestConfig.LaunchSpecifications.2.InstanceType=m3.medium
&SpotFleetRequestConfig.LaunchSpecifications.2.SubnetId=subnet-1a2b3c4d
&AUTHPARAMS

Sample Response

<RequestSpotFleetResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
    <requestId>60262cc5-2bd4-4c8d-98ed-example</requestId>
    <spotFleetRequestId>sfr-123f8fc2-cb31-425e-abcd-example2710</spotFleetRequestId>
</RequestSpotFleetResponse>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: