Skip to content

reset_instance_attribute async

reset_instance_attribute(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    dry_run: Optional[Boolean] = None,
    instance_id: Optional[InstanceId] = None,
    attribute: Optional[InstanceAttributeName] = None,
) -> None

Resets an attribute of an instance to its default value. To reset the kernel or ramdisk, the instance must be in a stopped state. To reset the sourceDestCheck, the instance can be either running or stopped.

The sourceDestCheck attribute controls whether source/destination checking is enabled. The default value is true, which means checking is enabled. This value must be false for a NAT instance to perform NAT. For more information, see NAT instances in the Amazon VPC User Guide.

Parameters:

  • dry_run (Optional[Boolean], default: None ) –

    Checks whether you have the required permissions for the operation, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • instance_id (Optional[InstanceId], default: None ) –

    The ID of the instance.

  • attribute (Optional[InstanceAttributeName], default: None ) –

    The attribute to reset.

    You can only reset the following attributes: kernel | ramdisk | sourceDestCheck.

Raises:

Examples:

To reset the sourceDestCheck attribute This example resets the sourceDestCheck attribute for the specified instance.

>>> await client.reset_instance_attribute(attribute='sourceDestCheck', instance_id='i-1234567890abcdef0')
Source code in docs_src/capo_ec2/_services/async_ec2.py
async def reset_instance_attribute(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    instance_id: Optional["capo_ec2.types.instance_id.InstanceId"] = None,
    attribute: Optional[
        "capo_ec2.types.instance_attribute_name.InstanceAttributeName"
    ] = None,
) -> None:
    """<p>Resets an attribute of an instance to its default value. To reset the <code>kernel</code> or <code>ramdisk</code>, the instance must be in a stopped state. To reset the <code>sourceDestCheck</code>, the instance can be either running or stopped.</p> <p>The <code>sourceDestCheck</code> attribute controls whether source/destination checking is enabled. The default value is <code>true</code>, which means checking is enabled. This value must be <code>false</code> for a NAT instance to perform NAT. For more information, see <a href="https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_NAT_Instance.html">NAT instances</a> in the <i>Amazon VPC User Guide</i>.</p>

    Args:
        dry_run: <p>Checks whether you have the required permissions for the operation, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
        instance_id: <p>The ID of the instance.</p>
        attribute: <p>The attribute to reset.</p> <important> <p>You can only reset the following attributes: <code>kernel</code> | <code>ramdisk</code> | <code>sourceDestCheck</code>.</p> </important>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To reset the sourceDestCheck attribute
        This example resets the sourceDestCheck attribute for the specified instance.

        >>> await client.reset_instance_attribute(attribute='sourceDestCheck', instance_id='i-1234567890abcdef0')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.reset_instance_attribute_request.ResetInstanceAttributeRequest]",
    ) -> AsyncOperationResponse[None]:
        import capo_ec2._operations.amazon_ec2.reset_instance_attribute

        (
            output,
            http_response,
        ) = await capo_ec2._operations.amazon_ec2.reset_instance_attribute.async_reset_instance_attribute(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ResetInstanceAttribute")
    )
    input_: capo_ec2.types.reset_instance_attribute_request.ResetInstanceAttributeRequest = {}
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if instance_id is not None:
        input_["instance_id"] = instance_id
    if attribute is not None:
        input_["attribute"] = attribute

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