Cancels an instance refresh or rollback that is in progress. If an instance refresh or rollback is not in progress, an ActiveInstanceRefreshNotFound error occurs.
This operation is part of the instance refresh feature in Amazon EC2 Auto Scaling, which helps you update instances in your Auto Scaling group after you make configuration changes.
When you cancel an instance refresh, this does not roll back any changes that it made. Use the RollbackInstanceRefresh API to roll back instead.
Parameters:
-
auto_scaling_group_name
(Optional[XmlStringMaxLen255], default:
None
)
–
The name of the Auto Scaling group.
-
wait_for_transitioning_instances
(Optional[BooleanType], default:
None
)
–
When cancelling an instance refresh, this indicates whether to wait for in-flight launches and terminations to complete. The default is true.
When set to false, Amazon EC2 Auto Scaling cancels the instance refresh without waiting for any pending launches or terminations to complete.
Raises:
-
ActiveInstanceRefreshNotFoundFault
–
The request failed because an active instance refresh or rollback for the specified Auto Scaling group was not found.
-
LimitExceededFault
–
You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see DescribeAccountLimits in the Amazon EC2 Auto Scaling API Reference.
-
ResourceContentionFault
–
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
-
UnknownServiceError
–
The service returned an error code this client does not model.
Examples:
To cancel an instance refresh
This example cancels an instance refresh operation in progress.
>>> await client.cancel_instance_refresh(auto_scaling_group_name='my-auto-scaling-group')
Source code in docs_src/capo_auto_scaling/_services/async_auto_scaling.py
| async def cancel_instance_refresh(
self,
*,
config_overrides: Optional[AsyncAutoScalingClientConfig] = None,
auto_scaling_group_name: Optional[
"capo_auto_scaling.types.xml_string_max_len255.XmlStringMaxLen255"
] = None,
wait_for_transitioning_instances: Optional[
"capo_auto_scaling.types.boolean_type.BooleanType"
] = None,
) -> "capo_auto_scaling.types.cancel_instance_refresh_answer.CancelInstanceRefreshAnswer":
"""<p>Cancels an instance refresh or rollback that is in progress. If an instance refresh or rollback is not in progress, an <code>ActiveInstanceRefreshNotFound</code> error occurs.</p> <p>This operation is part of the <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-instance-refresh.html">instance refresh feature</a> in Amazon EC2 Auto Scaling, which helps you update instances in your Auto Scaling group after you make configuration changes.</p> <p>When you cancel an instance refresh, this does not roll back any changes that it made. Use the <a href="https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_RollbackInstanceRefresh.html">RollbackInstanceRefresh</a> API to roll back instead.</p>
Args:
auto_scaling_group_name: <p>The name of the Auto Scaling group.</p>
wait_for_transitioning_instances: <p>When cancelling an instance refresh, this indicates whether to wait for in-flight launches and terminations to complete. The default is true.</p> <p>When set to false, Amazon EC2 Auto Scaling cancels the instance refresh without waiting for any pending launches or terminations to complete.</p>
Raises:
capo_auto_scaling.errors.active_instance_refresh_not_found_fault.ActiveInstanceRefreshNotFoundFault: <p>The request failed because an active instance refresh or rollback for the specified Auto Scaling group was not found.</p>
capo_auto_scaling.errors.limit_exceeded_fault.LimitExceededFault: <p>You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html">DescribeAccountLimits</a> in the <i>Amazon EC2 Auto Scaling API Reference</i>.</p>
capo_auto_scaling.errors.resource_contention_fault.ResourceContentionFault: <p>You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).</p>
capo_auto_scaling.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To cancel an instance refresh
This example cancels an instance refresh operation in progress.
>>> await client.cancel_instance_refresh(auto_scaling_group_name='my-auto-scaling-group')
"""
async def _handler(
req: "AsyncOperationRequest[capo_auto_scaling.types.cancel_instance_refresh_type.CancelInstanceRefreshType]",
) -> AsyncOperationResponse[
"capo_auto_scaling.types.cancel_instance_refresh_answer.CancelInstanceRefreshAnswer"
]:
import capo_auto_scaling._operations.auto_scaling_2011_01_01.cancel_instance_refresh
(
output,
http_response,
) = await capo_auto_scaling._operations.auto_scaling_2011_01_01.cancel_instance_refresh.async_cancel_instance_refresh(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CancelInstanceRefresh")
)
input_: capo_auto_scaling.types.cancel_instance_refresh_type.CancelInstanceRefreshType = {}
if auto_scaling_group_name is not None:
input_["auto_scaling_group_name"] = auto_scaling_group_name
if wait_for_transitioning_instances is not None:
input_["wait_for_transitioning_instances"] = (
wait_for_transitioning_instances
)
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|