Copies an existing backup within the same Amazon Web Services account to another Amazon Web Services Region (cross-Region copy) or within the same Amazon Web Services Region (in-Region copy). You can have up to five backup copy requests in progress to a single destination Region per account.
You can use cross-Region backup copies for cross-Region disaster recovery. You can periodically take backups and copy them to another Region so that in the event of a disaster in the primary Region, you can restore from backup and recover availability quickly in the other Region. You can make cross-Region copies only within your Amazon Web Services partition. A partition is a grouping of Regions. Amazon Web Services currently has three partitions: aws (Standard Regions), aws-cn (China Regions), and aws-us-gov (Amazon Web Services GovCloud [US] Regions).
You can also use backup copies to clone your file dataset to another Region or within the same Region.
You can use the SourceRegion parameter to specify the Amazon Web Services Region from which the backup will be copied. For example, if you make the call from the us-west-1 Region and want to copy a backup from the us-east-2 Region, you specify us-east-2 in the SourceRegion parameter to make a cross-Region copy. If you don't specify a Region, the backup copy is created in the same Region where the request is sent from (in-Region copy).
For more information about creating backup copies, see Copying backups in the Amazon FSx for Windows User Guide, Copying backups in the Amazon FSx for Lustre User Guide, and Copying backups in the Amazon FSx for OpenZFS User Guide.
Parameters:
-
source_backup_id
(Optional[SourceBackupId], default:
None
)
–
The ID of the source backup. Specifies the ID of the backup that's being copied.
-
source_region
(Optional[Region], default:
None
)
–
The source Amazon Web Services Region of the backup. Specifies the Amazon Web Services Region from which the backup is being copied. The source and destination Regions must be in the same Amazon Web Services partition. If you don't specify a Region, SourceRegion defaults to the Region where the request is sent from (in-Region copy).
-
copy_tags
(Optional[Flag], default:
None
)
–
A Boolean flag indicating whether tags from the source backup should be copied to the backup copy. This value defaults to false.
If you set CopyTags to true and the source backup has existing tags, you can use the Tags parameter to create new tags, provided that the sum of the source backup tags and the new tags doesn't exceed 50. Both sets of tags are merged. If there are tag conflicts (for example, two tags with the same key but different values), the tags created with the Tags parameter take precedence.
Raises:
-
BackupNotFound
–
No Amazon FSx backups were found based upon the supplied parameters.
-
BadRequest
–
A generic error indicating a failure with a client request.
-
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.
-
IncompatibleRegionForMultiAZ
–
Amazon FSx doesn't support Multi-AZ Windows File Server copy backup in the destination Region, so the copied backup can't be restored.
-
InternalServerError
–
A generic error indicating a server-side failure.
-
InvalidDestinationKmsKey
–
The Key Management Service (KMS) key of the destination backup is not valid.
-
InvalidRegion
–
The Region provided for SourceRegion is not valid or is in a different Amazon Web Services partition.
-
InvalidSourceKmsKey
–
The Key Management Service (KMS) key of the source backup is not valid.
-
ServiceLimitExceeded
–
An error indicating that a particular service limit was exceeded. You can increase some service limits by contacting Amazon Web Services Support.
-
SourceBackupUnavailable
–
The request was rejected because the lifecycle status of the source backup isn't AVAILABLE.
-
UnsupportedOperation
–
The requested operation is not supported for this resource or API.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Examples:
To copy a backup
This operation copies an Amazon FSx backup.
>>> client.copy_backup(source_backup_id='backup-03e3c82e0183b7b6b', source_region='us-east-2')
Source code in docs_src/capo_fsx/_services/f_sx.py
| def copy_backup(
self,
*,
config_overrides: Optional[FSxClientConfig] = None,
client_request_token: Optional[
"capo_fsx.types.client_request_token.ClientRequestToken"
] = None,
source_backup_id: Optional[
"capo_fsx.types.source_backup_id.SourceBackupId"
] = None,
source_region: Optional["capo_fsx.types.region.Region"] = None,
kms_key_id: Optional["capo_fsx.types.kms_key_id.KmsKeyId"] = None,
copy_tags: Optional["capo_fsx.types.flag.Flag"] = None,
tags: Optional["capo_fsx.types.tags.Tags"] = None,
) -> "capo_fsx.types.copy_backup_response.CopyBackupResponse":
"""<p>Copies an existing backup within the same Amazon Web Services account to another Amazon Web Services Region (cross-Region copy) or within the same Amazon Web Services Region (in-Region copy). You can have up to five backup copy requests in progress to a single destination Region per account.</p> <p>You can use cross-Region backup copies for cross-Region disaster recovery. You can periodically take backups and copy them to another Region so that in the event of a disaster in the primary Region, you can restore from backup and recover availability quickly in the other Region. You can make cross-Region copies only within your Amazon Web Services partition. A partition is a grouping of Regions. Amazon Web Services currently has three partitions: <code>aws</code> (Standard Regions), <code>aws-cn</code> (China Regions), and <code>aws-us-gov</code> (Amazon Web Services GovCloud [US] Regions).</p> <p>You can also use backup copies to clone your file dataset to another Region or within the same Region.</p> <p>You can use the <code>SourceRegion</code> parameter to specify the Amazon Web Services Region from which the backup will be copied. For example, if you make the call from the <code>us-west-1</code> Region and want to copy a backup from the <code>us-east-2</code> Region, you specify <code>us-east-2</code> in the <code>SourceRegion</code> parameter to make a cross-Region copy. If you don't specify a Region, the backup copy is created in the same Region where the request is sent from (in-Region copy).</p> <p>For more information about creating backup copies, see <a href="https://docs.aws.amazon.com/fsx/latest/WindowsGuide/using-backups.html#copy-backups"> Copying backups</a> in the <i>Amazon FSx for Windows User Guide</i>, <a href="https://docs.aws.amazon.com/fsx/latest/LustreGuide/using-backups-fsx.html#copy-backups">Copying backups</a> in the <i>Amazon FSx for Lustre User Guide</i>, and <a href="https://docs.aws.amazon.com/fsx/latest/OpenZFSGuide/using-backups.html#copy-backups">Copying backups</a> in the <i>Amazon FSx for OpenZFS User Guide</i>.</p>
Args:
source_backup_id: <p>The ID of the source backup. Specifies the ID of the backup that's being copied.</p>
source_region: <p>The source Amazon Web Services Region of the backup. Specifies the Amazon Web Services Region from which the backup is being copied. The source and destination Regions must be in the same Amazon Web Services partition. If you don't specify a Region, <code>SourceRegion</code> defaults to the Region where the request is sent from (in-Region copy).</p>
copy_tags: <p>A Boolean flag indicating whether tags from the source backup should be copied to the backup copy. This value defaults to <code>false</code>.</p> <p>If you set <code>CopyTags</code> to <code>true</code> and the source backup has existing tags, you can use the <code>Tags</code> parameter to create new tags, provided that the sum of the source backup tags and the new tags doesn't exceed 50. Both sets of tags are merged. If there are tag conflicts (for example, two tags with the same key but different values), the tags created with the <code>Tags</code> parameter take precedence.</p>
Raises:
capo_fsx.errors.backup_not_found.BackupNotFound: <p>No Amazon FSx backups were found based upon the supplied parameters.</p>
capo_fsx.errors.bad_request.BadRequest: <p>A generic error indicating a failure with a client request.</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.incompatible_region_for_multi_az.IncompatibleRegionForMultiAZ: <p>Amazon FSx doesn't support Multi-AZ Windows File Server copy backup in the destination Region, so the copied backup can't be restored.</p>
capo_fsx.errors.internal_server_error.InternalServerError: <p>A generic error indicating a server-side failure.</p>
capo_fsx.errors.invalid_destination_kms_key.InvalidDestinationKmsKey: <p>The Key Management Service (KMS) key of the destination backup is not valid.</p>
capo_fsx.errors.invalid_region.InvalidRegion: <p>The Region provided for <code>SourceRegion</code> is not valid or is in a different Amazon Web Services partition.</p>
capo_fsx.errors.invalid_source_kms_key.InvalidSourceKmsKey: <p>The Key Management Service (KMS) key of the source backup is not valid.</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.source_backup_unavailable.SourceBackupUnavailable: <p>The request was rejected because the lifecycle status of the source backup isn't <code>AVAILABLE</code>.</p>
capo_fsx.errors.unsupported_operation.UnsupportedOperation: <p>The requested operation is not supported for this resource or API.</p>
capo_fsx.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To copy a backup
This operation copies an Amazon FSx backup.
>>> client.copy_backup(source_backup_id='backup-03e3c82e0183b7b6b', source_region='us-east-2')
"""
def _handler(
req: "OperationRequest[capo_fsx.types.copy_backup_request.CopyBackupRequest]",
) -> OperationResponse[
"capo_fsx.types.copy_backup_response.CopyBackupResponse"
]:
import capo_fsx._operations.aws_simba_api_service_v20180301.copy_backup
output, http_response = (
capo_fsx._operations.aws_simba_api_service_v20180301.copy_backup.copy_backup(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
def _redact_output(
output: "capo_fsx.types.copy_backup_response.CopyBackupResponse",
) -> dict[str, Any]:
import capo_fsx.types.copy_backup_response
return capo_fsx.types.copy_backup_response.redact_sensitive(output)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("CopyBackup", redact_output=_redact_output),
)
input_: capo_fsx.types.copy_backup_request.CopyBackupRequest = {}
if client_request_token is None:
client_request_token = str(uuid.uuid4())
input_["client_request_token"] = client_request_token
if source_backup_id is not None:
input_["source_backup_id"] = source_backup_id
if source_region is not None:
input_["source_region"] = source_region
if kms_key_id is not None:
input_["kms_key_id"] = kms_key_id
if copy_tags is not None:
input_["copy_tags"] = copy_tags
if tags is not None:
input_["tags"] = tags
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|