

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 复制 Amazon DocumentDB 集群快照
<a name="backup_restore-copy_cluster_snapshot"></a>

在 Amazon DocumentDB 中，您可以将快照复制到同一个文件 Amazon Web Services 区域 或另一个文件中。 Amazon Web Services 区域您也可以将共享快照以相同 Amazon Web Services 区域 或不同的方式复制到您的帐户 Amazon Web Services 区域。有关共享快照的更多信息，请参阅[Amazon DocumentDB 集群快照共享](backup_restore-share_cluster_snapshots.md)。

**注意**  
Amazon DocumentDB 根据您保留的备份和快照数据量以及您保留的时间对您进行收费。有关与 Amazon DocumentDB 备份和快照关联的存储的更多信息，请参阅[了解 备份存储使用量](backup_restore-understanding_backup_storage_usage.md)。有关 Amazon DocumentDB 存储的定价信息，请参阅 [Amazon DocumentDB 定价](https://www.amazonaws.cn/documentdb/pricing/)。

**Topics**
+ [复制共享快照](#backup_restore-copy_shared_cluster_snapshot)
+ [跨越复制快照 Amazon Web Services 区域](#backup_restore-copy_snapshot_across_regions)
+ [限制](#backup_restore-copy_cluster_snapshot-limitations)
+ [处理加密](#backup_restore-copy_cluster_snapshot-handle_encryption)
+ [参数组注意事项](#backup_restore-copy_cluster_snapshot-parameter_group_considerations)
+ [复制集群快照](#backup_restore-copy_a_cluster_snapshot)

## 复制共享快照
<a name="backup_restore-copy_shared_cluster_snapshot"></a>

您可以复制其他 Amazon 账户与您共享的快照。如果您要复制已从其他 Amazon 账户共享的加密快照，则必须有权访问用于 Amazon KMS 加密快照的加密密钥。有关更多信息，请参阅 [处理加密](#backup_restore-copy_cluster_snapshot-handle_encryption)。

## 跨越复制快照 Amazon Web Services 区域
<a name="backup_restore-copy_snapshot_across_regions"></a>

当您将快照复制到与源快照不同的快照时 Amazon Web Services 区域，每个副本都是完整快照。 Amazon Web Services 区域 完整快照副本包含恢复 Amazon DocumentDB 集群需要的所有数据和元数据。

## 限制
<a name="backup_restore-copy_cluster_snapshot-limitations"></a>

复制快照时，存在以下一些限制：
+ 如果您在目标快照可用之前删除了源快照，则快照复制将失败。在删除源快照之前，请确保目标快照的状态为 `AVAILABLE`。
+ 每个账户最多可以同时进行到同一目标区域的五个快照复制请求。
+ 根据所 Amazon Web Services 区域 涉及的内容和要复制的数据量，跨区域快照复制可能需要数小时才能完成。有时，某一给定的源 Amazon Web Services 区域可能会发出大量跨区域快照复制请求。在这些情况下，Amazon DocumentDB 可能会将来自该来源的新跨区域复制请求放 Amazon Web Services 区域 入队列，直到一些正在进行的副本完成。当复制请求在队列中时，不显示有关这些复制请求的进度信息。复制开始后即显示进度信息。

## 处理加密
<a name="backup_restore-copy_cluster_snapshot-handle_encryption"></a>

您可以复制已使用 Amazon KMS 加密密钥加密的快照。如果您复制加密的快照，则此快照的副本也必须加密。如果您在其中复制加密快照 Amazon Web Services 区域，则可以使用与原始快照相同的 Amazon KMS 加密密钥对副本进行加密，也可以指定不同的 Amazon KMS 加密密钥。如果您跨区域复制加密快照，则不能对副本使用与源快照相同的 Amazon KMS 加密密钥，因为 Amazon KMS 密钥是特定于区域的。相反，您必须指定在目标 Amazon Web Services 区域 n 中有效的 Amazon KMS 密钥。

源快照在复制过程中保持加密状态。有关更多信息，请参阅 [Amazon DocumentDB 中的数据保护](security.data-protection.md)。

**注意**  
对于 Amazon DocumentDB 集群快照，在复制快照时，您无法对未加密的集群快照进行加密。

## 参数组注意事项
<a name="backup_restore-copy_cluster_snapshot-parameter_group_considerations"></a>

跨区域复制快照时，复制不包括由原始 Amazon DocumentDB 集群使用的参数组。当您还原快照以创建新集群时，该集群将获得创建 Amazon Web Services 区域 它的默认参数组。要为新的集群提供与源相同的参数组，您必须执行以下操作：

1. 在目标中 Amazon Web Services 区域，[使用与原始集群相同的设置创建一个 Amazon DocumentDB 集群参数组](https://docs.amazonaws.cn/documentdb/latest/developerguide/cluster_parameter_groups-create.html)。如果新版本中已经存在一个 Amazon Web Services 区域，则可以使用那个。

1. 在目标中恢复快照后 Amazon Web Services 区域，修改新的 Amazon DocumentDB 集群并添加上一步中的新参数组或现有参数组。有关更多信息，请参阅 [修改 Amazon DocumentDB 集群](db-cluster-modify.md)。

## 复制集群快照
<a name="backup_restore-copy_a_cluster_snapshot"></a>

您可以使用 Amazon Web Services 管理控制台 或复制 Amazon DocumentDB 集群 Amazon CLI，如下所示。

------
#### [ Using the Amazon Web Services 管理控制台 ]

要使用创建群集快照的副本 Amazon Web Services 管理控制台，请完成以下步骤。此过程适用于在相同 Amazon Web Services 区域 区域或跨区域复制加密或未加密的集群快照。

1. [登录 Amazon Web Services 管理控制台，然后在 /docdb 上打开亚马逊文档数据库控制台。https://console.aws.amazon.com](https://console.amazonaws.cn/docdb)

1. 在导航窗格中，选择**快照**，然后选择要复制的快照左侧的按钮。
**提示**  
如果您在屏幕左侧没有看到导航窗格，请在页面左上角选择菜单图标 (![](http://docs.amazonaws.cn/documentdb/latest/developerguide/images/docdb-menu-icon.png))。

1. 在 **Actions** 菜单中，选择 **Copy**。

1. 在出现的 **Make Copy of cluster snapshot**（复制集群快照）页面中，完成 **Settings**（设置）部分。

   1. **目标区域**：可选。要将集群快照复制到其他集群快照 Amazon Web Services 区域，请 Amazon Web Services 区域 为**目标区域**选择该快照。

   1. **新快照标识符**：输入新快照的名称。

      目标快照命名约束：
      + 不能是现有快照的名称。
      + 长度为 [1-63] 个字母、数字或连字符。
      + 第一个字符必须是字母。
      + 不能以连字符结尾或包含两个连续的连字符。
      + 每个区域的 Amazon RDS、Neptune 和 Amazon DocumentDB 中的所有集群都必须是唯一 Amazon Web Services 账户的。

   1. **复制标签**：要将您在源快照上拥有的任何标签复制到快照副本，请选择**复制标签**。

1. 完成 **E ncryption-at-rest** 部分。

   1. **静态加密**：如果您的快照未加密，则这些选项对您不适用，因为您无法从未加密的快照创建加密的副本。如果您的快照已加密，则可以更改静态加密期间 Amazon KMS key 使用的快照。

      有关对快照副本进行加密的更多信息，请参阅[复制集群快照加密](backup_restore-cluster_snapshot_considerations.md#backup_restore-encryption)。

      有关静态加密的更多信息，请参阅 [Amazon DocumentDB 静态数据加密](encryption-at-rest.md)。

   1. **Amazon KMS 密钥**-从下拉列表中选择以下选项之一：
      + **（默认）aws/r** ds — 账号和 Amazon KMS 密钥 ID 列在此选项后面。
      + **< some-key-name >** — 如果您创建了密钥，则会列出该密钥供您选择。
      + **输入一个密钥 ARN**：在 **ARN** 框中，输入 Amazon KMS 密钥的 Amazon 资源名称（ARN）。ARN 的格式为 `arn:aws:kms:<region>:<accountID>:key/<key-id> `。

1. 要制作所选快照的副本，请选择 **Copy snapshot (复制快照)**。或者，您可以选择**取消**以便不创建快照的副本。

------
#### [ Using the Amazon CLI ]

要使用 Amazon CLI创建未加密集群快照的副本，请使用带以下参数的 `copy-db-cluster-snapshot` 操作。如果要将快照复制到另一个快照 Amazon Web Services 区域，请运行将快照复制 Amazon Web Services 区域 到的命令。
+ **--source-db-cluster-snapshot-identifier**：必需。要制作副本的集群快照的标识符。集群快照必须存在并且处于可用 状态。如果您要将快照复制到另一个快照 Amazon Web Services 区域 或者要复制共享集群快照，则此标识符必须采用源集群快照的 ARN 格式。此参数不区分大小写。
+ **--target-db-cluster-snapshot-identifier**：必需。要从源集群快照创建的新集群快照标识符​。此参数不区分大小写。

  目标快照命名约束：
  + 不能是现有快照的名称。
  + 长度为 [1-63] 个字母、数字或连字符。
  + 第一个字符必须是字母。
  + 不能以连字符结尾或包含两个连续的连字符。
  + 每个区域的 Amazon RDS、Neptune 和 Amazon DocumentDB 中的所有集群都必须是唯一 Amazon Web Services 账户的。
+ **--source-region**— 如果您要将快照复制到另一个快照 Amazon Web Services 区域，请指定要从中复制加密的集群快照。 Amazon Web Services 区域 

  如果您复制快照到另一 Amazon Web Services 区域 ，且不指定 `--source-region`，则必须指定 `pre-signed-url` 选项代替。该`pre-signed-url`值必须是包含签名版本 4 签名请求的 URL，以便在复制集群快照的源 Amazon Web Services 区域 中调用`CopyDBClusterSnapshot`操作。要了解更多信息`pre-signed-url`，请参阅[复制DBCluster快照](https://docs.amazonaws.cn/documentdb/latest/developerguide/API_CopyDBClusterSnapshot.html)。
+ **--kms-key-id**：用于对集群快照副本进行加密的密钥的 KMS 密钥标识符。

  如果您要将加密的集群快照复制到另一个集群快照 Amazon Web Services 区域，则此参数为必填项。您必须为目标指定 KMS 密钥 Amazon Web Services 区域。

  如果您要在同一个中复制加密的集群快照 Amazon Web Services 区域，则 Amazon KMS 密钥参数是可选的。集群快照的副本使用与源集群快照相同的 Amazon KMS 密钥进行加密。如果要指定用于 Amazon KMS 加密副本的新加密密钥，则可以使用此参数进行加密。
+ **--copy-tags**— 可选。要复制过来的标签和值。

要在正在进行复制时取消操作，您可以在集群快照处于**正在复制**状态时删除由 `--target-db-cluster-snapshot-identifier` 或 `TargetDBClusterSnapshotIdentifier` 标识的目标集群快照。

**Example**  
**示例 1：将未加密的快照复制到同一区域**  
以下 Amazon CLI 示例创建了与源快照`sample-cluster-snapshot` Amazon Web Services 区域 相同`sample-cluster-snapshot-copy`的 named 的副本。创建副本时，原始快照上的所有标签都将复制到快照副本。  
对于 Linux、macOS 或 Unix：  

```
aws docdb copy-db-cluster-snapshot \
    --source-db-cluster-snapshot-identifier sample-cluster-snapshot \
    --target-db-cluster-snapshot-identifier sample-cluster-snapshot-copy \
    --copy-tags
```
对于 Windows：  

```
aws docdb copy-db-cluster-snapshot ^
    --source-db-cluster-snapshot-identifier sample-cluster-snapshot ^
    --target-db-cluster-snapshot-identifier sample-cluster-snapshot-copy ^
    --copy-tags
```
此操作的输出将类似于下文。  

```
{
    "DBClusterSnapshot": {
        "AvailabilityZones": [
            "us-east-1a",
            "us-east-1b",
            "us-east-1c"
        ],
        "DBClusterSnapshotIdentifier": "sample-cluster-snapshot-copy",
        "DBClusterIdentifier": "sample-cluster",
        "SnapshotCreateTime": "2020-03-27T08:40:24.805Z",
        "Engine": "docdb",
        "Status": "copying",
        "Port": 0,    
        "VpcId": "vpc-abcd0123",
        "ClusterCreateTime": "2020-01-10T22:13:38.261Z",
        "MasterUsername": "master-user",
        "EngineVersion": "4.0.0",
        "SnapshotType": "manual",
        "PercentProgress": 0,
        "StorageEncrypted": true,
        "KmsKeyId": "arn:aws:kms:us-east-1:111122223333:key/sample-key-id",
        "DBClusterSnapshotArn": "arn:aws:rds:us-east-1:111122223333:cluster-snapshot:sample-cluster-snapshot-copy",
        "SourceDBClusterSnapshotArn": "arn:aws:rds:us-east-1:111122223333:cluster-snapshot:sample-cluster-snapshot"
    }
}
```

**Example**  
**示例 2：跨复制未加密的快照 Amazon Web Services 区域**  
以下 Amazon CLI 示例创建了具有 AR `arn:aws:rds:us-east-1:123456789012:cluster-snapshot:sample-cluster-snapshot` N 的`sample-cluster-snapshot`副本。此副本命名为，`sample-cluster-snapshot-copy`并且 Amazon Web Services 区域 在其中运行命令。  
对于 Linux、macOS 或 Unix：  

```
aws docdb copy-db-cluster-snapshot \
    --source-db-cluster-snapshot-identifier arn:aws:rds:us-east-1:123456789012:cluster-snapshot:sample-cluster-snapshot \
    --target-db-cluster-snapshot-identifier sample-cluster-snapshot-copy
```
对于 Windows：  

```
aws docdb copy-db-cluster-snapshot ^
    --source-db-cluster-snapshot-identifier arn:aws:rds:us-east-1:123456789012:cluster-snapshot:sample-cluster-snapshot ^
    --target-db-cluster-snapshot-identifier sample-cluster-snapshot-copy
```
此操作的输出将类似于下文。  

```
{
    "DBClusterSnapshot": {
        "AvailabilityZones": [
            "us-east-1a",
            "us-east-1b",
            "us-east-1c"
        ],
        "DBClusterSnapshotIdentifier": "sample-cluster-snapshot-copy",
        "DBClusterIdentifier": "sample-cluster",
        "SnapshotCreateTime": "2020-04-29T16:45:51.239Z",
        "Engine": "docdb",
        "AllocatedStorage": 0,
        "Status": "copying",
        "Port": 0,
        "VpcId": "vpc-abc0123",
        "ClusterCreateTime": "2020-04-28T16:43:00.294Z",
        "MasterUsername": "master-user",
        "EngineVersion": "4.0.0",
        "LicenseModel": "docdb",
        "SnapshotType": "manual",
        "PercentProgress": 0,
        "StorageEncrypted": false,
        "DBClusterSnapshotArn": "arn:aws:rds:us-east-1:123456789012:cluster-snapshot:sample-cluster-snapshot-copy",
        "SourceDBClusterSnapshotArn": "arn:aws:rds:us-east-1:123456789012:cluster-snapshot:sample-cluster-snapshot",
    }
}
```

**Example**  
**示例 3：跨复制加密快照 Amazon Web Services 区域**  
以下 Amazon CLI 示例创建了`sample-cluster-snapshot`从 us-west-2 区域到 us-east-1 区域的副本。此命令是在 us-east-1 区域中调用。  
对于 Linux、macOS 或 Unix：  

```
aws docdb copy-db-cluster-snapshot \
    --source-db-cluster-snapshot-identifier arn:aws:rds:us-west-2:123456789012:cluster-snapshot:sample-cluster-snapshot \
    --target-db-cluster-snapshot-identifier sample-cluster-snapshot-copy \
    --source-region us-west-2 \
    --kms-key-id sample-us-east-1-key
```
对于 Windows：  

```
aws docdb copy-db-cluster-snapshot ^
    --source-db-cluster-snapshot-identifier arn:aws:rds:us-west-2:123456789012:cluster-snapshot:sample-cluster-snapshot ^
    --target-db-cluster-snapshot-identifier sample-cluster-snapshot-copy ^
    --source-region us-west-2 ^
    --kms-key-id sample-us-east-1-key
```
此操作的输出将类似于下文。  

```
{
    "DBClusterSnapshot": {  
        "AvailabilityZones": [],
        "DBClusterSnapshotIdentifier": "sample-cluster-snapshot-copy",
        "DBClusterIdentifier": "sample-cluster",
        "SnapshotCreateTime": "2020-04-29T16:45:53.159Z",
        "Engine": "docdb",
        "AllocatedStorage": 0,
        "Status": "copying",
        "Port": 0,
        "ClusterCreateTime": "2020-04-28T16:43:07.129Z",
        "MasterUsername": "chimera",
        "EngineVersion": "4.0.0",
        "LicenseModel": "docdb",
        "SnapshotType": "manual",
        "PercentProgress": 0,
        "StorageEncrypted": true,
        "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/0846496a-d48e-41c4-9353-86d8301d7e35",
        "DBClusterSnapshotArn": "arn:aws:rds:us-east-1:123456789012:cluster-snapshot:sample-cluster-snapshot-copy",
        "SourceDBClusterSnapshotArn": "arn:aws:rds:us-west-2:123456789012:cluster-snapshot:sample-cluster-snapshot",
    }
}
```

**Example**  
**示例 4：跨复制未加密的共享快照 Amazon Web Services 区域**  
以下 Amazon CLI 示例，账户-`123456789012`，创建了账户`sample-cluster-snapshot`共享的未加密集群快照的副本，该快照`999999999999`从 us-east-1 区域到 us-west-2 区域。在 us-west-2 区域中调用此命令。有关共享快照的更多信息，请参阅[共享快照](backup_restore-share_cluster_snapshots.md#backup_restore-share_snapshots)。  
对于 Linux、macOS 或 Unix：  

```
aws docdb copy-db-cluster-snapshot \
--region us-west-2 \
--source-db-cluster-snapshot-identifier arn:aws:rds:us-east-1:999999999999:cluster-snapshot:sample-cluster-snapshot \
--target-db-cluster-snapshot-identifier sample-cluster-snapshot-copy
```
对于 Windows：  

```
aws docdb copy-db-cluster-snapshot ^
--region us-west-2 ^
--source-db-cluster-snapshot-identifier arn:aws:rds:us-east-1:999999999999:cluster-snapshot:sample-cluster-snapshot ^
--target-db-cluster-snapshot-identifier sample-cluster-snapshot-copy
```
此操作的输出将类似于下文。  

```
{
 "DBClusterSnapshots": [
 {
 "AvailabilityZones": [],
 "DBClusterSnapshotIdentifier": "sample-cluster-snapshot-copy",
 "DBClusterIdentifier": "sample-cluster",
 "SnapshotCreateTime": "2025-08-22T11:27:00.497000+00:00",
 "Engine": "docdb",
 "Status": "copying",
 "Port": 0,
 "ClusterCreateTime": "2024-07-02T16:44:50.246000+00:00",
 "MasterUsername": "master-user",
 "EngineVersion": "5.0.0",
 "SnapshotType": "manual",
 "PercentProgress": 0,
 "StorageEncrypted": false,
 "DBClusterSnapshotArn": "arn:aws:rds:us-west-2:123456789012:cluster-snapshot:sample-cluster-snapshot-copy",
 "SourceDBClusterSnapshotArn": "arn:aws:rds:us-east-1:999999999999:cluster-snapshot:sample-cluster-snapshot"
 }
 ]
}
```

**Example**  
**示例 5：跨复制加密的共享快照 Amazon Web Services 区域**  
以下 Amazon CLI 示例，账户-`123456789012` 创建账户`sample-cluster-snapshot`共享的加密集群快照的副本，`999999999999`从 us-east-1 区域到 us-west-2 区域。目标快照使用客户管理的 KMS 密钥进行加密：`arn:aws:kms:us-west-2:123456789012:key/6c1f3264-1797-472b-ba37-03011e682d28`。在 us-west-2 区域中调用此命令。有关共享快照的更多信息，请参阅[共享快照](backup_restore-share_cluster_snapshots.md#backup_restore-share_snapshots)。  
对于 Linux、macOS 或 Unix：  

```
aws docdb copy-db-cluster-snapshot \
--region us-west-2 \
--source-db-cluster-snapshot-identifier arn:aws:rds:us-east-1:999999999999:cluster-snapshot:sample-cluster-snapshot \
--target-db-cluster-snapshot-identifier sample-cluster-snapshot-copy \
--kms-key-id arn:aws:kms:us-west-2:123456789012:key/6c1f3264-1797-472b-ba37-03011e682d28
```
对于 Windows：  

```
aws docdb copy-db-cluster-snapshot ^
--region us-west-2 ^
--source-db-cluster-snapshot-identifier arn:aws:rds:us-east-1:999999999999:cluster-snapshot:sample-cluster-snapshot ^
--target-db-cluster-snapshot-identifier sample-cluster-snapshot-copy ^
--kms-key-id arn:aws:kms:us-west-2:123456789012:key/6c1f3264-1797-472b-ba37-03011e682d28
```
此操作的输出将类似于下文。  

```
{
 "DBClusterSnapshots": [
 {
 "AvailabilityZones": [],
 "DBClusterSnapshotIdentifier": "sample-cluster-snapshot-copy",
 "DBClusterIdentifier": "sample-cluster",
 "SnapshotCreateTime": "2025-08-22T11:27:00.497000+00:00",
 "Engine": "docdb",
 "Status": "copying",
 "Port": 0,
 "ClusterCreateTime": "2024-07-02T16:44:50.246000+00:00",
 "MasterUsername": "master-user",
 "EngineVersion": "5.0.0",
 "SnapshotType": "manual",
 "PercentProgress": 0,
 "StorageEncrypted": true,
 "KmsKeyId": "arn:aws:kms:us-west-2:123456789012:key/6c1f3264-1797-472b-ba37-03011e682d28",
 "DBClusterSnapshotArn": "arn:aws:rds:us-west-2:123456789012:cluster-snapshot:sample-cluster-snapshot-copy",
 "SourceDBClusterSnapshotArn": "arn:aws:rds:us-east-1:999999999999:cluster-snapshot:sample-cluster-snapshot"
 }
 ]
}
```

**注意**  
有关对快照副本进行加密的更多信息，请参阅[复制集群快照加密](backup_restore-cluster_snapshot_considerations.md#backup_restore-encryption)。  
有关静态加密的更多信息，请参阅 [Amazon DocumentDB 静态数据加密](encryption-at-rest.md)。

------