Skip to content

deregister_instance async

deregister_instance(
    service_id: Arn,
    instance_id: ResourceId,
    *,
    config_overrides: Optional[AsyncServiceDiscoveryClientConfig] = None,
) -> DeregisterInstanceResponse

Deletes the Amazon Route 53 DNS records and health check, if any, that Cloud Map created for the specified instance.

Parameters:

  • service_id (Arn) –

    The ID or Amazon Resource Name (ARN) of the service that the instance is associated with. If the namespace associated with the service is shared with your account, specify the service ARN. For more information about shared namespaces, see Cross-account Cloud Map namespace sharing in the Cloud Map Developer Guide.

  • instance_id (ResourceId) –

    The value that you specified for Id in the RegisterInstance request.

Raises:

  • DuplicateRequest –

    The operation is already in progress.

  • InstanceNotFound –

    No instance exists with the specified ID, or the instance was recently registered, and information about the instance hasn't propagated yet.

  • InvalidInput –

    One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.

  • ResourceInUse –

    The specified resource can't be deleted because it contains other resources. For example, you can't delete a service that contains any instances.

  • ServiceNotFound –

    No service exists with the specified ID.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

Example: Deregister a service instance Example: Deregister a service instance

>>> await client.deregister_instance(service_id='srv-p5zdwlg5uvvzjita', instance_id='myservice-53')
Deregister instance using service ARN
Deregisters an instance using a service ARN instead of service ID, useful when working with shared namespaces.
>>> await client.deregister_instance(instance_id='i-abcd1234xmpl5678', service_id='arn:aws:servicediscovery:us-west-2:123456789012:service/srv-abcd1234xmpl5678')
Source code in docs_src/capo_servicediscovery/_services/async_service_discovery.py
async def deregister_instance(
    self,
    service_id: "capo_servicediscovery.types.arn.Arn",
    instance_id: "capo_servicediscovery.types.resource_id.ResourceId",
    *,
    config_overrides: Optional[AsyncServiceDiscoveryClientConfig] = None,
) -> "capo_servicediscovery.types.deregister_instance_response.DeregisterInstanceResponse":
    """<p>Deletes the Amazon Route 53 DNS records and health check, if any, that Cloud Map created for the specified instance.</p>

    Args:
        service_id: <p>The ID or Amazon Resource Name (ARN) of the service that the instance is associated with. If the namespace associated with the service is shared with your account, specify the service ARN. For more information about shared namespaces, see <a href="https://docs.aws.amazon.com/cloud-map/latest/dg/sharing-namespaces.html">Cross-account Cloud Map namespace sharing</a> in the <i>Cloud Map Developer Guide</i>.</p>
        instance_id: <p>The value that you specified for <code>Id</code> in the <a href="https://docs.aws.amazon.com/cloud-map/latest/api/API_RegisterInstance.html">RegisterInstance</a> request.</p>

    Raises:
        capo_servicediscovery.errors.duplicate_request.DuplicateRequest: <p>The operation is already in progress.</p>
        capo_servicediscovery.errors.instance_not_found.InstanceNotFound: <p>No instance exists with the specified ID, or the instance was recently registered, and information about the instance hasn't propagated yet.</p>
        capo_servicediscovery.errors.invalid_input.InvalidInput: <p>One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.</p>
        capo_servicediscovery.errors.resource_in_use.ResourceInUse: <p>The specified resource can't be deleted because it contains other resources. For example, you can't delete a service that contains any instances.</p>
        capo_servicediscovery.errors.service_not_found.ServiceNotFound: <p>No service exists with the specified ID.</p>
        capo_servicediscovery.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Example: Deregister a service instance
        Example: Deregister a service instance

        >>> await client.deregister_instance(service_id='srv-p5zdwlg5uvvzjita', instance_id='myservice-53')
        Deregister instance using service ARN
        Deregisters an instance using a service ARN instead of service ID, useful when working with shared namespaces.

        >>> await client.deregister_instance(instance_id='i-abcd1234xmpl5678', service_id='arn:aws:servicediscovery:us-west-2:123456789012:service/srv-abcd1234xmpl5678')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_servicediscovery.types.deregister_instance_request.DeregisterInstanceRequest]",
    ) -> AsyncOperationResponse[
        "capo_servicediscovery.types.deregister_instance_response.DeregisterInstanceResponse"
    ]:
        import capo_servicediscovery._operations.route53_auto_naming_v20170314.deregister_instance

        (
            output,
            http_response,
        ) = await capo_servicediscovery._operations.route53_auto_naming_v20170314.deregister_instance.async_deregister_instance(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeregisterInstance")
    )
    input_: capo_servicediscovery.types.deregister_instance_request.DeregisterInstanceRequest = {
        "service_id": service_id,
        "instance_id": instance_id,
    }

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