Cancel (delete) a Spot Fleet request - Amazon Elastic Compute Cloud

Cancel (delete) a Spot Fleet request

If you no longer require a Spot Fleet, you can cancel the Spot Fleet request, which deletes the request. After you cancel a fleet request, all Spot requests associated with the fleet are also canceled, so that no new Spot Instances are launched.

When you cancel a Spot Fleet request, you must also specify if you want to terminate all of its instances. These include both On-Demand Instances and Spot Instances.

If you specify that the instances must be terminated when the fleet request is canceled, the fleet request enters the cancelled_terminating state. Otherwise, it enters the cancelled_running state, and the instances continue to run until they are interrupted or you terminate them manually.

Restrictions
  • You can cancel up to 100 fleets in a single request. If you exceed the specified number, no fleets are canceled.

To cancel (delete) a Spot Fleet request (console)
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the navigation pane, choose Spot Requests.

  3. Select your Spot Fleet request.

  4. Choose Actions, Cancel request.

  5. In the Cancel Spot request dialog box, do the following:

    1. To terminate the associated instances at the same time as canceling the Spot Fleet request, leave the Terminate instances checkbox selected. To cancel the Spot Fleet request without terminating the associated instances, clear the Terminate instances checkbox.

    2. Choose Confirm.

To cancel (delete) a Spot Fleet request and terminate its instances using the AWS CLI

Use the cancel-spot-fleet-requests command to cancel the specified Spot Fleet request and terminate its On-Demand Instances and Spot Instances.

aws ec2 cancel-spot-fleet-requests \ --spot-fleet-request-ids sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE \ --terminate-instances

Example output

{ "SuccessfulFleetRequests": [ { "SpotFleetRequestId": "sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE", "CurrentSpotFleetRequestState": "cancelled_terminating", "PreviousSpotFleetRequestState": "active" } ], "UnsuccessfulFleetRequests": [] }
To cancel (delete) a Spot Fleet request without terminating its instances using the AWS CLI

You can modify the previous command using the --no-terminate-instances parameter to cancel the specified Spot Fleet request without terminating its On-Demand Instances and Spot Instances.

aws ec2 cancel-spot-fleet-requests \ --spot-fleet-request-ids sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE \ --no-terminate-instances

Example output

{ "SuccessfulFleetRequests": [ { "SpotFleetRequestId": "sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE", "CurrentSpotFleetRequestState": "cancelled_running", "PreviousSpotFleetRequestState": "active" } ], "UnsuccessfulFleetRequests": [] }