Skip to content

enter_standby async

enter_standby(
    *,
    config_overrides: Optional[AsyncAutoScalingClientConfig] = None,
    instance_ids: Optional[InstanceIds] = None,
    auto_scaling_group_name: Optional[XmlStringMaxLen255] = None,
    should_decrement_desired_capacity: Optional[ShouldDecrementDesiredCapacity] = None,
) -> EnterStandbyAnswer

Moves the specified instances into the standby state.

If you choose to decrement the desired capacity of the Auto Scaling group, the instances can enter standby as long as the desired capacity of the Auto Scaling group after the instances are placed into standby is equal to or greater than the minimum capacity of the group.

If you choose not to decrement the desired capacity of the Auto Scaling group, the Auto Scaling group launches new instances to replace the instances on standby.

For more information, see Temporarily removing instances from your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.

Parameters:

  • instance_ids (Optional[InstanceIds], default: None ) –

    The IDs of the instances. You can specify up to 20 instances.

  • auto_scaling_group_name (Optional[XmlStringMaxLen255], default: None ) –

    The name of the Auto Scaling group.

  • should_decrement_desired_capacity (Optional[ShouldDecrementDesiredCapacity], default: None ) –

    Indicates whether to decrement the desired capacity of the Auto Scaling group by the number of instances moved to Standby mode.

Raises:

  • 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 move instances into standby mode This example puts the specified instance into standby mode.

>>> await client.enter_standby(instance_ids=['i-93633f9b'], auto_scaling_group_name='my-auto-scaling-group', should_decrement_desired_capacity=True)
Source code in docs_src/capo_auto_scaling/_services/async_auto_scaling.py
async def enter_standby(
    self,
    *,
    config_overrides: Optional[AsyncAutoScalingClientConfig] = None,
    instance_ids: Optional[
        "capo_auto_scaling.types.instance_ids.InstanceIds"
    ] = None,
    auto_scaling_group_name: Optional[
        "capo_auto_scaling.types.xml_string_max_len255.XmlStringMaxLen255"
    ] = None,
    should_decrement_desired_capacity: Optional[
        "capo_auto_scaling.types.should_decrement_desired_capacity.ShouldDecrementDesiredCapacity"
    ] = None,
) -> "capo_auto_scaling.types.enter_standby_answer.EnterStandbyAnswer":
    """<p>Moves the specified instances into the standby state.</p> <p>If you choose to decrement the desired capacity of the Auto Scaling group, the instances can enter standby as long as the desired capacity of the Auto Scaling group after the instances are placed into standby is equal to or greater than the minimum capacity of the group.</p> <p>If you choose not to decrement the desired capacity of the Auto Scaling group, the Auto Scaling group launches new instances to replace the instances on standby.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-enter-exit-standby.html">Temporarily removing instances from your Auto Scaling group</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p>

    Args:
        instance_ids: <p>The IDs of the instances. You can specify up to 20 instances.</p>
        auto_scaling_group_name: <p>The name of the Auto Scaling group.</p>
        should_decrement_desired_capacity: <p>Indicates whether to decrement the desired capacity of the Auto Scaling group by the number of instances moved to <code>Standby</code> mode.</p>

    Raises:
        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 move instances into standby mode
        This example puts the specified instance into standby mode.

        >>> await client.enter_standby(instance_ids=['i-93633f9b'], auto_scaling_group_name='my-auto-scaling-group', should_decrement_desired_capacity=True)
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_auto_scaling.types.enter_standby_query.EnterStandbyQuery]",
    ) -> AsyncOperationResponse[
        "capo_auto_scaling.types.enter_standby_answer.EnterStandbyAnswer"
    ]:
        import capo_auto_scaling._operations.auto_scaling_2011_01_01.enter_standby

        (
            output,
            http_response,
        ) = await capo_auto_scaling._operations.auto_scaling_2011_01_01.enter_standby.async_enter_standby(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("EnterStandby")
    )
    input_: capo_auto_scaling.types.enter_standby_query.EnterStandbyQuery = {}
    if instance_ids is not None:
        input_["instance_ids"] = instance_ids
    if auto_scaling_group_name is not None:
        input_["auto_scaling_group_name"] = auto_scaling_group_name
    if should_decrement_desired_capacity is not None:
        input_["should_decrement_desired_capacity"] = (
            should_decrement_desired_capacity
        )

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output