Skip to content

deregister_managed_instance

deregister_managed_instance(
    instance_id: ManagedInstanceId,
    *,
    config_overrides: Optional[SSMClientConfig] = None,
) -> DeregisterManagedInstanceResult

Removes the server or virtual machine from the list of registered servers.

If you want to reregister an on-premises server, edge device, or VM, you must use a different Activation Code and Activation ID than used to register the machine previously. The Activation Code and Activation ID must not have already been used on the maximum number of activations specified when they were created. For more information, see Deregistering managed nodes in a hybrid and multicloud environment in the Amazon Web Services Systems Manager User Guide.

Parameters:

  • instance_id (ManagedInstanceId) –

    The ID assigned to the managed node when you registered it using the activation process.

Raises:

  • InternalServerError –

    An error occurred on the server side.

  • InvalidInstanceId –

    The following problems can cause this exception:

    • You don't have permission to access the managed node.

    • Amazon Web Services Systems Manager Agent (SSM Agent) isn't running. Verify that SSM Agent is running.

    • SSM Agent isn't registered with the SSM endpoint. Try reinstalling SSM Agent.

    • The managed node isn't in a valid state. Valid states are: Running, Pending, Stopped, and Stopping. Invalid states are: Shutting-down and Terminated.

  • UnknownServiceError –

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

Source code in docs_src/capo_ssm/_services/ssm.py
def deregister_managed_instance(
    self,
    instance_id: "capo_ssm.types.managed_instance_id.ManagedInstanceId",
    *,
    config_overrides: Optional[SSMClientConfig] = None,
) -> "capo_ssm.types.deregister_managed_instance_result.DeregisterManagedInstanceResult":
    """<p>Removes the server or virtual machine from the list of registered servers.</p> <p>If you want to reregister an on-premises server, edge device, or VM, you must use a different Activation Code and Activation ID than used to register the machine previously. The Activation Code and Activation ID must not have already been used on the maximum number of activations specified when they were created. For more information, see <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/fleet-manager-deregister-hybrid-nodes.html">Deregistering managed nodes in a hybrid and multicloud environment</a> in the <i>Amazon Web Services Systems Manager User Guide</i>.</p>

    Args:
        instance_id: <p>The ID assigned to the managed node when you registered it using the activation process. </p>

    Raises:
        capo_ssm.errors.internal_server_error.InternalServerError: <p>An error occurred on the server side.</p>
        capo_ssm.errors.invalid_instance_id.InvalidInstanceId: <p>The following problems can cause this exception:</p> <ul> <li> <p>You don't have permission to access the managed node.</p> </li> <li> <p>Amazon Web Services Systems Manager Agent (SSM Agent) isn't running. Verify that SSM Agent is running.</p> </li> <li> <p>SSM Agent isn't registered with the SSM endpoint. Try reinstalling SSM Agent.</p> </li> <li> <p>The managed node isn't in a valid state. Valid states are: <code>Running</code>, <code>Pending</code>, <code>Stopped</code>, and <code>Stopping</code>. Invalid states are: <code>Shutting-down</code> and <code>Terminated</code>.</p> </li> </ul>
        capo_ssm.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_ssm.types.deregister_managed_instance_request.DeregisterManagedInstanceRequest]",
    ) -> OperationResponse[
        "capo_ssm.types.deregister_managed_instance_result.DeregisterManagedInstanceResult"
    ]:
        import capo_ssm._operations.amazon_ssm.deregister_managed_instance

        output, http_response = (
            capo_ssm._operations.amazon_ssm.deregister_managed_instance.deregister_managed_instance(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeregisterManagedInstance")
    )
    input_: capo_ssm.types.deregister_managed_instance_request.DeregisterManagedInstanceRequest = {
        "instance_id": instance_id
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output