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

CancelSpotFleetRequests

Cancels the specified Spot fleet requests.

After you cancel a Spot fleet request, the Spot fleet launches no new Spot instances. You must specify whether the Spot fleet should also terminate its Spot instances. If you terminate the instances, the Spot fleet request enters the cancelled_terminating state. Otherwise, the Spot fleet request enters the cancelled_running state and the instances continue to run until they are interrupted or you terminate them manually.

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

SpotFleetRequestId.N

The IDs of the Spot fleet requests.

Type: array of Strings

Required: Yes

TerminateInstances

Indicates whether to terminate instances for a Spot fleet request if it is canceled successfully.

Type: Boolean

Required: Yes

Response Elements

The following elements are returned by the service.

requestId

The ID of the request.

Type: String

successfulFleetRequestSet

Information about the Spot fleet requests that are successfully canceled.

Type: array of CancelSpotFleetRequestsSuccessItem objects

unsuccessfulFleetRequestSet

Information about the Spot fleet requests that are not successfully canceled.

Type: array of CancelSpotFleetRequestsErrorItem objects

Errors

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

Example

Example

This example cancels Spot fleet request sfr-123f8fc2-cb31-425e-abcd-example2710 and terminates all instances that were launched by the request.

Sample Request

Copy
https://ec2.amazonaws.com/?Action=CancelSpotFleetRequests &SpotFleetRequestId.1=sfr-123f8fc2-cb31-425e-abcd-example2710 &TerminateInstances=true &AUTHPARAMS

Sample Response

Copy
<CancelSpotFleetRequestsResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/"> <requestId>e12d2fe5-6503-4b4b-911c-example</requestId> <unsuccessfulFleetRequestSet/> <successfulFleetRequestSet> <item> <spotFleetRequestId>sfr-123f8fc2-cb31-425e-abcd-example2710</spotFleetRequestId> <currentSpotFleetRequestState>cancelled_terminating</currentSpotFleetRequestState> <previousSpotFleetRequestState>active</previousSpotFleetRequestState> </item> </successfulFleetRequestSet> </CancelSpotFleetRequestsResponse>

See Also

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