Skip to content

delete_notebook_instance

delete_notebook_instance(
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    notebook_instance_name: Optional[NotebookInstanceName] = None,
) -> None

Deletes an SageMaker AI notebook instance. Before you can delete a notebook instance, you must call the StopNotebookInstance API.

When you delete a notebook instance, you lose all of your data. SageMaker AI removes the ML compute instance, and deletes the ML storage volume and the network interface associated with the notebook instance.

Parameters:

Raises:

Source code in docs_src/capo_sagemaker/_services/sage_maker.py
def delete_notebook_instance(
    self,
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    notebook_instance_name: Optional[
        "capo_sagemaker.types.notebook_instance_name.NotebookInstanceName"
    ] = None,
) -> None:
    """<p> Deletes an SageMaker AI notebook instance. Before you can delete a notebook instance, you must call the <code>StopNotebookInstance</code> API. </p> <important> <p>When you delete a notebook instance, you lose all of your data. SageMaker AI removes the ML compute instance, and deletes the ML storage volume and the network interface associated with the notebook instance. </p> </important>

    Args:
        notebook_instance_name: <p>The name of the SageMaker AI notebook instance to delete.</p>

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

    def _handler(
        req: "OperationRequest[capo_sagemaker.types.delete_notebook_instance_input.DeleteNotebookInstanceInput]",
    ) -> OperationResponse[None]:
        import capo_sagemaker._operations.sage_maker.delete_notebook_instance

        output, http_response = (
            capo_sagemaker._operations.sage_maker.delete_notebook_instance.delete_notebook_instance(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteNotebookInstance")
    )
    input_: capo_sagemaker.types.delete_notebook_instance_input.DeleteNotebookInstanceInput = {}
    if notebook_instance_name is not None:
        input_["notebook_instance_name"] = notebook_instance_name

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