Skip to content

delete_association async

delete_association(
    *,
    config_overrides: Optional[AsyncSSMClientConfig] = None,
    name: Optional[DocumentARN] = None,
    instance_id: Optional[InstanceId] = None,
    association_id: Optional[AssociationId] = None,
) -> DeleteAssociationResult

Disassociates the specified Amazon Web Services Systems Manager document (SSM document) from the specified managed node. If you created the association by using the Targets parameter, then you must delete the association by using the association ID.

When you disassociate a document from a managed node, it doesn't change the configuration of the node. To change the configuration state of a managed node after you disassociate a document, you must create a new document with the desired configuration and associate it with the node.

Parameters:

  • name (Optional[DocumentARN], default: None ) –

    The name of the SSM document.

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

    The managed node ID.

    InstanceId has been deprecated. To specify a managed node ID for an association, use the Targets parameter. Requests that include the parameter InstanceID with Systems Manager documents (SSM documents) that use schema version 2.0 or later will fail. In addition, if you use the parameter InstanceId, you can't use the parameters AssociationName, DocumentVersion, MaxErrors, MaxConcurrency, OutputLocation, or ScheduleExpression. To use these parameters, you must use the Targets parameter.

  • association_id (Optional[AssociationId], default: None ) –

    The association ID that you want to delete.

Raises:

  • AssociationDoesNotExist –

    The specified association doesn't exist.

  • InternalServerError –

    An error occurred on the server side.

  • InvalidDocument –

    The specified SSM document doesn't exist.

  • 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.

  • TooManyUpdates –

    There are concurrent updates for a resource that supports one update at a time.

  • UnknownServiceError –

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

Source code in docs_src/capo_ssm/_services/async_ssm.py
async def delete_association(
    self,
    *,
    config_overrides: Optional[AsyncSSMClientConfig] = None,
    name: Optional["capo_ssm.types.document_arn.DocumentARN"] = None,
    instance_id: Optional["capo_ssm.types.instance_id.InstanceId"] = None,
    association_id: Optional["capo_ssm.types.association_id.AssociationId"] = None,
) -> "capo_ssm.types.delete_association_result.DeleteAssociationResult":
    """<p>Disassociates the specified Amazon Web Services Systems Manager document (SSM document) from the specified managed node. If you created the association by using the <code>Targets</code> parameter, then you must delete the association by using the association ID.</p> <p>When you disassociate a document from a managed node, it doesn't change the configuration of the node. To change the configuration state of a managed node after you disassociate a document, you must create a new document with the desired configuration and associate it with the node.</p>

    Args:
        name: <p>The name of the SSM document.</p>
        instance_id: <p>The managed node ID.</p> <note> <p> <code>InstanceId</code> has been deprecated. To specify a managed node ID for an association, use the <code>Targets</code> parameter. Requests that include the parameter <code>InstanceID</code> with Systems Manager documents (SSM documents) that use schema version 2.0 or later will fail. In addition, if you use the parameter <code>InstanceId</code>, you can't use the parameters <code>AssociationName</code>, <code>DocumentVersion</code>, <code>MaxErrors</code>, <code>MaxConcurrency</code>, <code>OutputLocation</code>, or <code>ScheduleExpression</code>. To use these parameters, you must use the <code>Targets</code> parameter.</p> </note>
        association_id: <p>The association ID that you want to delete.</p>

    Raises:
        capo_ssm.errors.association_does_not_exist.AssociationDoesNotExist: <p>The specified association doesn't exist.</p>
        capo_ssm.errors.internal_server_error.InternalServerError: <p>An error occurred on the server side.</p>
        capo_ssm.errors.invalid_document.InvalidDocument: <p>The specified SSM document doesn't exist.</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.too_many_updates.TooManyUpdates: <p>There are concurrent updates for a resource that supports one update at a time.</p>
        capo_ssm.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ssm.types.delete_association_request.DeleteAssociationRequest]",
    ) -> AsyncOperationResponse[
        "capo_ssm.types.delete_association_result.DeleteAssociationResult"
    ]:
        import capo_ssm._operations.amazon_ssm.delete_association

        (
            output,
            http_response,
        ) = await capo_ssm._operations.amazon_ssm.delete_association.async_delete_association(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteAssociation")
    )
    input_: capo_ssm.types.delete_association_request.DeleteAssociationRequest = {}
    if name is not None:
        input_["name"] = name
    if instance_id is not None:
        input_["instance_id"] = instance_id
    if association_id is not None:
        input_["association_id"] = association_id

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