AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Cancels the specified Spot Fleet requests.
After you cancel a Spot Fleet request, the Spot Fleet launches no new instances.
You must also specify whether a canceled Spot Fleet request should terminate its instances.
If you choose to 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.
Terminating an instance is permanent and irreversible.
After you terminate an instance, you can no longer connect to it, and it can't be recovered. All attached Amazon EBS volumes that are configured to be deleted on termination are also permanently deleted and can't be recovered. All data stored on instance store volumes is permanently lost. For more information, see How instance termination works.
Before you terminate an instance, ensure that you have backed up all data that you need to retain after the termination to persistent storage.
Restrictions
You can delete up to 100 fleets in a single request. If you exceed the specified number, no fleets are deleted.
For .NET Core this operation is only available in asynchronous form. Please refer to CancelSpotFleetRequestsAsync.
Namespace: Amazon.EC2
Assembly: AWSSDK.EC2.dll
Version: 3.x.y.z
public virtual CancelSpotFleetRequestsResponse CancelSpotFleetRequests( CancelSpotFleetRequestsRequest request )
Container for the necessary parameters to execute the CancelSpotFleetRequests service method.
This example cancels the specified Spot fleet request and terminates its associated Spot Instances.
var client = new AmazonEC2Client();
var response = client.CancelSpotFleetRequests(new CancelSpotFleetRequestsRequest
{
SpotFleetRequestIds = new List<string> {
"sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE"
},
TerminateInstances = true
});
List<CancelSpotFleetRequestsSuccessItem> successfulFleetRequests = response.SuccessfulFleetRequests;
This example cancels the specified Spot fleet request without terminating its associated Spot Instances.
var client = new AmazonEC2Client();
var response = client.CancelSpotFleetRequests(new CancelSpotFleetRequestsRequest
{
SpotFleetRequestIds = new List<string> {
"sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE"
},
TerminateInstances = false
});
List<CancelSpotFleetRequestsSuccessItem> successfulFleetRequests = response.SuccessfulFleetRequests;
.NET Framework:
Supported in: 4.5 and newer, 3.5