cancel_spot_fleet_requests
async
¶
cancel_spot_fleet_requests(
*,
config_overrides: Optional[AsyncEC2ClientConfig] = None,
dry_run: Optional[Boolean] = None,
spot_fleet_request_ids: Optional[SpotFleetRequestIdList] = None,
terminate_instances: Optional[Boolean] = None,
) -> CancelSpotFleetRequestsResponse
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.
Parameters:
-
dry_run(Optional[Boolean], default:None) –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. -
spot_fleet_request_ids(Optional[SpotFleetRequestIdList], default:None) –The IDs of the Spot Fleet requests.
Constraint: You can specify up to 100 IDs in a single request.
-
terminate_instances(Optional[Boolean], default:None) –Indicates whether to terminate the associated instances when the Spot Fleet request is canceled. The default is to terminate the instances.
To let the instances continue to run after the Spot Fleet request is canceled, specify
no-terminate-instances.
Raises:
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To cancel a Spot fleet request This example cancels the specified Spot fleet request and terminates its associated Spot Instances.
>>> await client.cancel_spot_fleet_requests(spot_fleet_request_ids=['sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE'], terminate_instances=True)
To cancel a Spot fleet request without terminating its Spot Instances
This example cancels the specified Spot fleet request without terminating its associated Spot Instances.
>>> await client.cancel_spot_fleet_requests(spot_fleet_request_ids=['sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE'], terminate_instances=False)
Source code in docs_src/capo_ec2/_services/async_ec2.py
6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 | |