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 isUnauthorizedOperation
.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 client error codes.
Examples
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
https://ec2.amazonaws.com/?Action=CancelSpotFleetRequests
&SpotFleetRequestId.1=sfr-123f8fc2-cb31-425e-abcd-example2710
&TerminateInstances=true
&AUTHPARAMS
Sample Response
<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: