Skip to content

delete_file_system

delete_file_system(
    *,
    config_overrides: Optional[FSxClientConfig] = None,
    file_system_id: Optional[FileSystemId] = None,
    client_request_token: Optional[ClientRequestToken] = None,
    windows_configuration: Optional[DeleteFileSystemWindowsConfiguration] = None,
    lustre_configuration: Optional[DeleteFileSystemLustreConfiguration] = None,
    open_zfs_configuration: Optional[DeleteFileSystemOpenZFSConfiguration] = None,
) -> DeleteFileSystemResponse

Deletes a file system. After deletion, the file system no longer exists, and its data is gone. Any existing automatic backups and snapshots are also deleted.

To delete an Amazon FSx for NetApp ONTAP file system, first delete all the volumes and storage virtual machines (SVMs) on the file system. Then provide a FileSystemId value to the DeleteFileSystem operation.

Before deleting an Amazon FSx for OpenZFS file system, make sure that there aren't any Amazon S3 access points attached to any volume. For more information on how to list S3 access points that are attached to volumes, see Listing S3 access point attachments. For more information on how to delete S3 access points, see Deleting an S3 access point attachment.

By default, when you delete an Amazon FSx for Windows File Server file system, a final backup is created upon deletion. This final backup isn't subject to the file system's retention policy, and must be manually deleted.

To delete an Amazon FSx for Lustre file system, first unmount it from every connected Amazon EC2 instance, then provide a FileSystemId value to the DeleteFileSystem operation. By default, Amazon FSx will not take a final backup when the DeleteFileSystem operation is invoked. On file systems not linked to an Amazon S3 bucket, set SkipFinalBackup to false to take a final backup of the file system you are deleting. Backups cannot be enabled on S3-linked file systems. To ensure all of your data is written back to S3 before deleting your file system, you can either monitor for the AgeOfOldestQueuedMessage metric to be zero (if using automatic export) or you can run an export data repository task. If you have automatic export enabled and want to use an export data repository task, you have to disable automatic export before executing the export data repository task.

The DeleteFileSystem operation returns while the file system has the DELETING status. You can check the file system deletion status by calling the DescribeFileSystems operation, which returns a list of file systems in your account. If you pass the file system ID for a deleted file system, the DescribeFileSystems operation returns a FileSystemNotFound error.

If a data repository task is in a PENDING or EXECUTING state, deleting an Amazon FSx for Lustre file system will fail with an HTTP status code 400 (Bad Request).

The data in a deleted file system is also deleted and can't be recovered by any means.

Parameters:

  • file_system_id (Optional[FileSystemId], default: None ) –

    The ID of the file system that you want to delete.

  • client_request_token (Optional[ClientRequestToken], default: None ) –

    A string of up to 63 ASCII characters that Amazon FSx uses to ensure idempotent deletion. This token is automatically filled on your behalf when using the Command Line Interface (CLI) or an Amazon Web Services SDK.

  • open_zfs_configuration (Optional[DeleteFileSystemOpenZFSConfiguration], default: None ) –

    The configuration object for the OpenZFS file system used in the DeleteFileSystem operation.

Raises:

  • BadRequest –

    A generic error indicating a failure with a client request.

  • FileSystemNotFound –

    No Amazon FSx file systems were found based upon supplied parameters.

  • IncompatibleParameterError –

    The error returned when a second request is received with the same client request token but different parameters settings. A client request token should always uniquely identify a single request.

  • InternalServerError –

    A generic error indicating a server-side failure.

  • ServiceLimitExceeded –

    An error indicating that a particular service limit was exceeded. You can increase some service limits by contacting Amazon Web Services Support.

  • UnknownServiceError –

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

Examples:

To delete a file system This operation deletes an Amazon FSx file system.

>>> client.delete_file_system(file_system_id='fs-0498eed5fe91001ec')
Source code in docs_src/capo_fsx/_services/f_sx.py
def delete_file_system(
    self,
    *,
    config_overrides: Optional[FSxClientConfig] = None,
    file_system_id: Optional["capo_fsx.types.file_system_id.FileSystemId"] = None,
    client_request_token: Optional[
        "capo_fsx.types.client_request_token.ClientRequestToken"
    ] = None,
    windows_configuration: Optional[
        "capo_fsx.types.delete_file_system_windows_configuration.DeleteFileSystemWindowsConfiguration"
    ] = None,
    lustre_configuration: Optional[
        "capo_fsx.types.delete_file_system_lustre_configuration.DeleteFileSystemLustreConfiguration"
    ] = None,
    open_zfs_configuration: Optional[
        "capo_fsx.types.delete_file_system_open_zfs_configuration.DeleteFileSystemOpenZFSConfiguration"
    ] = None,
) -> "capo_fsx.types.delete_file_system_response.DeleteFileSystemResponse":
    """<p>Deletes a file system. After deletion, the file system no longer exists, and its data is gone. Any existing automatic backups and snapshots are also deleted.</p> <p>To delete an Amazon FSx for NetApp ONTAP file system, first delete all the volumes and storage virtual machines (SVMs) on the file system. Then provide a <code>FileSystemId</code> value to the <code>DeleteFileSystem</code> operation.</p> <p>Before deleting an Amazon FSx for OpenZFS file system, make sure that there aren't any Amazon S3 access points attached to any volume. For more information on how to list S3 access points that are attached to volumes, see <a href="https://docs.aws.amazon.com/fsx/latest/OpenZFSGuide/access-points-list.html">Listing S3 access point attachments</a>. For more information on how to delete S3 access points, see <a href="https://docs.aws.amazon.com/fsx/latest/OpenZFSGuide/delete-access-point.html">Deleting an S3 access point attachment</a>.</p> <p>By default, when you delete an Amazon FSx for Windows File Server file system, a final backup is created upon deletion. This final backup isn't subject to the file system's retention policy, and must be manually deleted.</p> <p>To delete an Amazon FSx for Lustre file system, first <a href="https://docs.aws.amazon.com/fsx/latest/LustreGuide/unmounting-fs.html">unmount</a> it from every connected Amazon EC2 instance, then provide a <code>FileSystemId</code> value to the <code>DeleteFileSystem</code> operation. By default, Amazon FSx will not take a final backup when the <code>DeleteFileSystem</code> operation is invoked. On file systems not linked to an Amazon S3 bucket, set <code>SkipFinalBackup</code> to <code>false</code> to take a final backup of the file system you are deleting. Backups cannot be enabled on S3-linked file systems. To ensure all of your data is written back to S3 before deleting your file system, you can either monitor for the <a href="https://docs.aws.amazon.com/fsx/latest/LustreGuide/monitoring-cloudwatch.html#auto-import-export-metrics">AgeOfOldestQueuedMessage</a> metric to be zero (if using automatic export) or you can run an <a href="https://docs.aws.amazon.com/fsx/latest/LustreGuide/export-data-repo-task-dra.html">export data repository task</a>. If you have automatic export enabled and want to use an export data repository task, you have to disable automatic export before executing the export data repository task.</p> <p>The <code>DeleteFileSystem</code> operation returns while the file system has the <code>DELETING</code> status. You can check the file system deletion status by calling the <a href="https://docs.aws.amazon.com/fsx/latest/APIReference/API_DescribeFileSystems.html">DescribeFileSystems</a> operation, which returns a list of file systems in your account. If you pass the file system ID for a deleted file system, the <code>DescribeFileSystems</code> operation returns a <code>FileSystemNotFound</code> error.</p> <note> <p>If a data repository task is in a <code>PENDING</code> or <code>EXECUTING</code> state, deleting an Amazon FSx for Lustre file system will fail with an HTTP status code 400 (Bad Request).</p> </note> <important> <p>The data in a deleted file system is also deleted and can't be recovered by any means.</p> </important>

    Args:
        file_system_id: <p>The ID of the file system that you want to delete.</p>
        client_request_token: <p>A string of up to 63 ASCII characters that Amazon FSx uses to ensure idempotent deletion. This token is automatically filled on your behalf when using the Command Line Interface (CLI) or an Amazon Web Services SDK.</p>
        open_zfs_configuration: <p>The configuration object for the OpenZFS file system used in the <code>DeleteFileSystem</code> operation.</p>

    Raises:
        capo_fsx.errors.bad_request.BadRequest: <p>A generic error indicating a failure with a client request.</p>
        capo_fsx.errors.file_system_not_found.FileSystemNotFound: <p>No Amazon FSx file systems were found based upon supplied parameters.</p>
        capo_fsx.errors.incompatible_parameter_error.IncompatibleParameterError: <p>The error returned when a second request is received with the same client request token but different parameters settings. A client request token should always uniquely identify a single request.</p>
        capo_fsx.errors.internal_server_error.InternalServerError: <p>A generic error indicating a server-side failure.</p>
        capo_fsx.errors.service_limit_exceeded.ServiceLimitExceeded: <p>An error indicating that a particular service limit was exceeded. You can increase some service limits by contacting Amazon Web Services Support.</p>
        capo_fsx.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To delete a file system
        This operation deletes an Amazon FSx file system.

        >>> client.delete_file_system(file_system_id='fs-0498eed5fe91001ec')
    """

    def _handler(
        req: "OperationRequest[capo_fsx.types.delete_file_system_request.DeleteFileSystemRequest]",
    ) -> OperationResponse[
        "capo_fsx.types.delete_file_system_response.DeleteFileSystemResponse"
    ]:
        import capo_fsx._operations.aws_simba_api_service_v20180301.delete_file_system

        output, http_response = (
            capo_fsx._operations.aws_simba_api_service_v20180301.delete_file_system.delete_file_system(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteFileSystem")
    )
    input_: capo_fsx.types.delete_file_system_request.DeleteFileSystemRequest = {}
    if file_system_id is not None:
        input_["file_system_id"] = file_system_id
    if client_request_token is None:
        client_request_token = str(uuid.uuid4())
    input_["client_request_token"] = client_request_token
    if windows_configuration is not None:
        input_["windows_configuration"] = windows_configuration
    if lustre_configuration is not None:
        input_["lustre_configuration"] = lustre_configuration
    if open_zfs_configuration is not None:
        input_["open_zfs_configuration"] = open_zfs_configuration

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