Skip to content

create_backup async

create_backup(
    *,
    config_overrides: Optional[AsyncFSxClientConfig] = None,
    file_system_id: Optional[FileSystemId] = None,
    client_request_token: Optional[ClientRequestToken] = None,
    tags: Optional[Tags] = None,
    volume_id: Optional[VolumeId] = None,
) -> CreateBackupResponse

Creates a backup of an existing Amazon FSx for Windows File Server file system, Amazon FSx for Lustre file system, Amazon FSx for NetApp ONTAP volume, or Amazon FSx for OpenZFS file system. We recommend creating regular backups so that you can restore a file system or volume from a backup if an issue arises with the original file system or volume.

For Amazon FSx for Lustre file systems, you can create a backup only for file systems that have the following configuration:

  • A Persistent deployment type

  • Are not linked to a data repository

For more information about backups, see the following:

If a backup with the specified client request token exists and the parameters match, this operation returns the description of the existing backup. If a backup with the specified client request token exists and the parameters don't match, this operation returns IncompatibleParameterError. If a backup with the specified client request token doesn't exist, CreateBackup does the following:

  • Creates a new Amazon FSx backup with an assigned ID, and an initial lifecycle state of CREATING.

  • Returns the description of the backup.

By using the idempotent operation, you can retry a CreateBackup operation without the risk of creating an extra backup. This approach can be useful when an initial call fails in a way that makes it unclear whether a backup was created. If you use the same client request token and the initial call created a backup, the operation returns a successful result because all the parameters are the same.

The CreateBackup operation returns while the backup's lifecycle state is still CREATING. You can check the backup creation status by calling the DescribeBackups operation, which returns the backup state along with other information.

Parameters:

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

    The ID of the file system to back up.

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

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

  • tags (Optional[Tags], default: None ) –

    (Optional) The tags to apply to the backup at backup creation. The key value of the Name tag appears in the console as the backup name. If you have set CopyTagsToBackups to true, and you specify one or more tags using the CreateBackup operation, no existing file system tags are copied from the file system to the backup.

  • volume_id (Optional[VolumeId], default: None ) –

    (Optional) The ID of the FSx for ONTAP volume to back up.

Raises:

  • BackupInProgress –

    Another backup is already under way. Wait for completion before initiating additional backups of this file system.

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

  • UnsupportedOperation –

    The requested operation is not supported for this resource or API.

  • VolumeNotFound –

    No Amazon FSx volumes were found based upon the supplied parameters.

  • UnknownServiceError –

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

Source code in docs_src/capo_fsx/_services/async_f_sx.py
async def create_backup(
    self,
    *,
    config_overrides: Optional[AsyncFSxClientConfig] = 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,
    tags: Optional["capo_fsx.types.tags.Tags"] = None,
    volume_id: Optional["capo_fsx.types.volume_id.VolumeId"] = None,
) -> "capo_fsx.types.create_backup_response.CreateBackupResponse":
    """<p>Creates a backup of an existing Amazon FSx for Windows File Server file system, Amazon FSx for Lustre file system, Amazon FSx for NetApp ONTAP volume, or Amazon FSx for OpenZFS file system. We recommend creating regular backups so that you can restore a file system or volume from a backup if an issue arises with the original file system or volume.</p> <p>For Amazon FSx for Lustre file systems, you can create a backup only for file systems that have the following configuration:</p> <ul> <li> <p>A Persistent deployment type</p> </li> <li> <p>Are <i>not</i> linked to a data repository</p> </li> </ul> <p>For more information about backups, see the following:</p> <ul> <li> <p>For Amazon FSx for Lustre, see <a href="https://docs.aws.amazon.com/fsx/latest/LustreGuide/using-backups-fsx.html">Working with FSx for Lustre backups</a>.</p> </li> <li> <p>For Amazon FSx for Windows, see <a href="https://docs.aws.amazon.com/fsx/latest/WindowsGuide/using-backups.html">Working with FSx for Windows backups</a>.</p> </li> <li> <p>For Amazon FSx for NetApp ONTAP, see <a href="https://docs.aws.amazon.com/fsx/latest/ONTAPGuide/using-backups.html">Working with FSx for NetApp ONTAP backups</a>.</p> </li> <li> <p>For Amazon FSx for OpenZFS, see <a href="https://docs.aws.amazon.com/fsx/latest/OpenZFSGuide/using-backups.html">Working with FSx for OpenZFS backups</a>.</p> </li> </ul> <p>If a backup with the specified client request token exists and the parameters match, this operation returns the description of the existing backup. If a backup with the specified client request token exists and the parameters don't match, this operation returns <code>IncompatibleParameterError</code>. If a backup with the specified client request token doesn't exist, <code>CreateBackup</code> does the following: </p> <ul> <li> <p>Creates a new Amazon FSx backup with an assigned ID, and an initial lifecycle state of <code>CREATING</code>.</p> </li> <li> <p>Returns the description of the backup.</p> </li> </ul> <p>By using the idempotent operation, you can retry a <code>CreateBackup</code> operation without the risk of creating an extra backup. This approach can be useful when an initial call fails in a way that makes it unclear whether a backup was created. If you use the same client request token and the initial call created a backup, the operation returns a successful result because all the parameters are the same.</p> <p>The <code>CreateBackup</code> operation returns while the backup's lifecycle state is still <code>CREATING</code>. You can check the backup creation status by calling the <a href="https://docs.aws.amazon.com/fsx/latest/APIReference/API_DescribeBackups.html">DescribeBackups</a> operation, which returns the backup state along with other information.</p>

    Args:
        file_system_id: <p>The ID of the file system to back up.</p>
        client_request_token: <p>(Optional) A string of up to 63 ASCII characters that Amazon FSx uses to ensure idempotent creation. This string is automatically filled on your behalf when you use the Command Line Interface (CLI) or an Amazon Web Services SDK.</p>
        tags: <p>(Optional) The tags to apply to the backup at backup creation. The key value of the <code>Name</code> tag appears in the console as the backup name. If you have set <code>CopyTagsToBackups</code> to <code>true</code>, and you specify one or more tags using the <code>CreateBackup</code> operation, no existing file system tags are copied from the file system to the backup.</p>
        volume_id: <p>(Optional) The ID of the FSx for ONTAP volume to back up.</p>

    Raises:
        capo_fsx.errors.backup_in_progress.BackupInProgress: <p>Another backup is already under way. Wait for completion before initiating additional backups of this file system.</p>
        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.unsupported_operation.UnsupportedOperation: <p>The requested operation is not supported for this resource or API.</p>
        capo_fsx.errors.volume_not_found.VolumeNotFound: <p>No Amazon FSx volumes were found based upon the supplied parameters.</p>
        capo_fsx.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_fsx.types.create_backup_request.CreateBackupRequest]",
    ) -> AsyncOperationResponse[
        "capo_fsx.types.create_backup_response.CreateBackupResponse"
    ]:
        import capo_fsx._operations.aws_simba_api_service_v20180301.create_backup

        (
            output,
            http_response,
        ) = await capo_fsx._operations.aws_simba_api_service_v20180301.create_backup.async_create_backup(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_fsx.types.create_backup_response.CreateBackupResponse",
    ) -> dict[str, Any]:
        import capo_fsx.types.create_backup_response

        return capo_fsx.types.create_backup_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateBackup", redact_output=_redact_output),
    )
    input_: capo_fsx.types.create_backup_request.CreateBackupRequest = {}
    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 tags is not None:
        input_["tags"] = tags
    if volume_id is not None:
        input_["volume_id"] = volume_id

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