cancelSpotFleetRequests
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.
Samples
fun main() {
//sampleStart
// This example cancels the specified Spot fleet request and terminates its associated Spot Instances.
val resp = ec2Client.cancelSpotFleetRequests {
spotFleetRequestIds = listOf<String>(
"sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE"
)
terminateInstances = true
}
//sampleEnd
}
fun main() {
//sampleStart
// This example cancels the specified Spot fleet request without terminating its associated Spot
// Instances.
val resp = ec2Client.cancelSpotFleetRequests {
spotFleetRequestIds = listOf<String>(
"sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE"
)
terminateInstances = false
}
//sampleEnd
}