cancel_spot_fleet_requests
¶
cancel_spot_fleet_requests(
*,
config_overrides: Optional[EC2ClientConfig] = 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.
>>> 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.
>>> 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/ec2.py
6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 | |