FSx / Client / delete_file_system

delete_file_system#

FSx.Client.delete_file_system(**kwargs)#

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.

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.

Note

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

Warning

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

See also: AWS API Documentation

Request Syntax

response = client.delete_file_system(
    FileSystemId='string',
    ClientRequestToken='string',
    WindowsConfiguration={
        'SkipFinalBackup': True|False,
        'FinalBackupTags': [
            {
                'Key': 'string',
                'Value': 'string'
            },
        ]
    },
    LustreConfiguration={
        'SkipFinalBackup': True|False,
        'FinalBackupTags': [
            {
                'Key': 'string',
                'Value': 'string'
            },
        ]
    },
    OpenZFSConfiguration={
        'SkipFinalBackup': True|False,
        'FinalBackupTags': [
            {
                'Key': 'string',
                'Value': 'string'
            },
        ],
        'Options': [
            'DELETE_CHILD_VOLUMES_AND_SNAPSHOTS',
        ]
    }
)
Parameters:
  • FileSystemId (string) –

    [REQUIRED]

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

  • ClientRequestToken (string) –

    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.

    This field is autopopulated if not provided.

  • WindowsConfiguration (dict) –

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

    • SkipFinalBackup (boolean) –

      By default, Amazon FSx for Windows takes a final backup on your behalf when the DeleteFileSystem operation is invoked. Doing this helps protect you from data loss, and we highly recommend taking the final backup. If you want to skip this backup, use this flag to do so.

    • FinalBackupTags (list) –

      A set of tags for your final backup.

      • (dict) –

        Specifies a key-value pair for a resource tag.

        • Key (string) – [REQUIRED]

          A value that specifies the TagKey, the name of the tag. Tag keys must be unique for the resource to which they are attached.

        • Value (string) – [REQUIRED]

          A value that specifies the TagValue, the value assigned to the corresponding tag key. Tag values can be null and don’t have to be unique in a tag set. For example, you can have a key-value pair in a tag set of finances : April and also of payroll : April.

  • LustreConfiguration (dict) –

    The configuration object for the Amazon FSx for Lustre file system being deleted in the DeleteFileSystem operation.

    • SkipFinalBackup (boolean) –

      Set SkipFinalBackup to false if you want to take a final backup of the file system you are deleting. By default, Amazon FSx will not take a final backup on your behalf when the DeleteFileSystem operation is invoked. (Default = true)

      Note

      The fsx:CreateBackup permission is required if you set SkipFinalBackup to false in order to delete the file system and take a final backup.

    • FinalBackupTags (list) –

      Use if SkipFinalBackup is set to false, and you want to apply an array of tags to the final backup. If you have set the file system property CopyTagsToBackups to true, and you specify one or more FinalBackupTags when deleting a file system, Amazon FSx will not copy any existing file system tags to the backup.

      • (dict) –

        Specifies a key-value pair for a resource tag.

        • Key (string) – [REQUIRED]

          A value that specifies the TagKey, the name of the tag. Tag keys must be unique for the resource to which they are attached.

        • Value (string) – [REQUIRED]

          A value that specifies the TagValue, the value assigned to the corresponding tag key. Tag values can be null and don’t have to be unique in a tag set. For example, you can have a key-value pair in a tag set of finances : April and also of payroll : April.

  • OpenZFSConfiguration (dict) –

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

    • SkipFinalBackup (boolean) –

      By default, Amazon FSx for OpenZFS takes a final backup on your behalf when the DeleteFileSystem operation is invoked. Doing this helps protect you from data loss, and we highly recommend taking the final backup. If you want to skip taking a final backup, set this value to true.

    • FinalBackupTags (list) –

      A list of tags to apply to the file system’s final backup.

      • (dict) –

        Specifies a key-value pair for a resource tag.

        • Key (string) – [REQUIRED]

          A value that specifies the TagKey, the name of the tag. Tag keys must be unique for the resource to which they are attached.

        • Value (string) – [REQUIRED]

          A value that specifies the TagValue, the value assigned to the corresponding tag key. Tag values can be null and don’t have to be unique in a tag set. For example, you can have a key-value pair in a tag set of finances : April and also of payroll : April.

    • Options (list) –

      To delete a file system if there are child volumes present below the root volume, use the string DELETE_CHILD_VOLUMES_AND_SNAPSHOTS. If your file system has child volumes and you don’t use this option, the delete request will fail.

      • (string) –

Return type:

dict

Returns:

Response Syntax

{
    'FileSystemId': 'string',
    'Lifecycle': 'AVAILABLE'|'CREATING'|'FAILED'|'DELETING'|'MISCONFIGURED'|'UPDATING'|'MISCONFIGURED_UNAVAILABLE',
    'WindowsResponse': {
        'FinalBackupId': 'string',
        'FinalBackupTags': [
            {
                'Key': 'string',
                'Value': 'string'
            },
        ]
    },
    'LustreResponse': {
        'FinalBackupId': 'string',
        'FinalBackupTags': [
            {
                'Key': 'string',
                'Value': 'string'
            },
        ]
    },
    'OpenZFSResponse': {
        'FinalBackupId': 'string',
        'FinalBackupTags': [
            {
                'Key': 'string',
                'Value': 'string'
            },
        ]
    }
}

Response Structure

  • (dict) –

    The response object for the DeleteFileSystem operation.

    • FileSystemId (string) –

      The ID of the file system that’s being deleted.

    • Lifecycle (string) –

      The file system lifecycle for the deletion request. If the DeleteFileSystem operation is successful, this status is DELETING.

    • WindowsResponse (dict) –

      The response object for the Microsoft Windows file system used in the DeleteFileSystem operation.

      • FinalBackupId (string) –

        The ID of the final backup for this file system.

      • FinalBackupTags (list) –

        The set of tags applied to the final backup.

        • (dict) –

          Specifies a key-value pair for a resource tag.

          • Key (string) –

            A value that specifies the TagKey, the name of the tag. Tag keys must be unique for the resource to which they are attached.

          • Value (string) –

            A value that specifies the TagValue, the value assigned to the corresponding tag key. Tag values can be null and don’t have to be unique in a tag set. For example, you can have a key-value pair in a tag set of finances : April and also of payroll : April.

    • LustreResponse (dict) –

      The response object for the Amazon FSx for Lustre file system being deleted in the DeleteFileSystem operation.

      • FinalBackupId (string) –

        The ID of the final backup for this file system.

      • FinalBackupTags (list) –

        The set of tags applied to the final backup.

        • (dict) –

          Specifies a key-value pair for a resource tag.

          • Key (string) –

            A value that specifies the TagKey, the name of the tag. Tag keys must be unique for the resource to which they are attached.

          • Value (string) –

            A value that specifies the TagValue, the value assigned to the corresponding tag key. Tag values can be null and don’t have to be unique in a tag set. For example, you can have a key-value pair in a tag set of finances : April and also of payroll : April.

    • OpenZFSResponse (dict) –

      The response object for the OpenZFS file system that’s being deleted in the DeleteFileSystem operation.

      • FinalBackupId (string) –

        The ID of the source backup. Specifies the backup that you are copying.

      • FinalBackupTags (list) –

        A list of Tag values, with a maximum of 50 elements.

        • (dict) –

          Specifies a key-value pair for a resource tag.

          • Key (string) –

            A value that specifies the TagKey, the name of the tag. Tag keys must be unique for the resource to which they are attached.

          • Value (string) –

            A value that specifies the TagValue, the value assigned to the corresponding tag key. Tag values can be null and don’t have to be unique in a tag set. For example, you can have a key-value pair in a tag set of finances : April and also of payroll : April.

Exceptions

  • FSx.Client.exceptions.BadRequest

  • FSx.Client.exceptions.IncompatibleParameterError

  • FSx.Client.exceptions.FileSystemNotFound

  • FSx.Client.exceptions.ServiceLimitExceeded

  • FSx.Client.exceptions.InternalServerError

Examples

This operation deletes an Amazon FSx file system.

response = client.delete_file_system(
    FileSystemId='fs-0498eed5fe91001ec',
)

print(response)

Expected Output:

{
    'FileSystemId': 'fs-0498eed5fe91001ec',
    'Lifecycle': 'DELETING',
    'ResponseMetadata': {
        '...': '...',
    },
}