EC2.Client.
cancel_spot_instance_requests
(**kwargs)¶Cancels one or more Spot Instance requests.
Warning
Canceling a Spot Instance request does not terminate running Spot Instances associated with the request.
See also: AWS API Documentation
Request Syntax
response = client.cancel_spot_instance_requests(
DryRun=True|False,
SpotInstanceRequestIds=[
'string',
]
)
DryRunOperation
. Otherwise, it is UnauthorizedOperation
.[REQUIRED]
One or more Spot Instance request IDs.
dict
Response Syntax
{
'CancelledSpotInstanceRequests': [
{
'SpotInstanceRequestId': 'string',
'State': 'active'|'open'|'closed'|'cancelled'|'completed'
},
]
}
Response Structure
(dict) --
Contains the output of CancelSpotInstanceRequests.
CancelledSpotInstanceRequests (list) --
One or more Spot Instance requests.
(dict) --
Describes a request to cancel a Spot Instance.
SpotInstanceRequestId (string) --
The ID of the Spot Instance request.
State (string) --
The state of the Spot Instance request.
Examples
This example cancels a Spot Instance request.
response = client.cancel_spot_instance_requests(
SpotInstanceRequestIds=[
'sir-08b93456',
],
)
print(response)
Expected Output:
{
'CancelledSpotInstanceRequests': [
{
'SpotInstanceRequestId': 'sir-08b93456',
'State': 'cancelled',
},
],
'ResponseMetadata': {
'...': '...',
},
}