正在复制 Amazon DocumentDB 集群快照 - Amazon DocumentDB
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

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

正在复制 Amazon DocumentDB 集群快照

在 Amazon DocumentDB 中,您可以将手动快照和自动快照复制到同一个账户 Amazon Web Services 区域 中的同一个账户 Amazon Web Services 区域 或另一个账户中。您也可以在同一快照 Amazon Web Services 账户 中共享其他人拥有的快照 Amazon Web Services 区域。但是,您不能在单个步骤 Amazon Web Services 账户 中跨 Amazon Web Services 区域 和复制集群快照。这些操作必须单独执行。

除了复制之外,您还可以与其他人共享手动快照 Amazon Web Services 账户。有关更多信息,请参阅 Amazon DocumentDB 集群快照共享

注意

Amazon DocumentDB 根据您保留的备份和快照数据量以及您保留的时间对您进行收费。有关与 Amazon DocumentDB 备份和快照关联的存储的更多信息,请参阅 了解备份存储使用量。有关 Amazon DocumentDB 存储的定价信息,请参阅 Amazon DocumentDB 定价

复制共享快照

您可以复制其他人共享给您的快照 Amazon Web Services 账户。如果您要复制已从另一个快照共享的加密快照 Amazon Web Services 账户,则必须有权访问用于 Amazon KMS 加密快照的加密密钥。

无论快照是否加密 Amazon Web Services 区域,您都只能在同一快照中复制共享快照。有关更多信息,请参阅 处理加密

跨复制快照 Amazon Web Services 区域

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

根据所 Amazon Web Services 区域 涉及的内容和要复制的数据量,跨区域快照复制可能需要数小时才能完成。有时,某一给定的源 Amazon Web Services 区域可能会发出大量跨区域快照复制请求。在这些情况下,Amazon DocumentDB 可能会将来自该来源的新跨区域复制请求放 Amazon Web Services 区域 入队列,直到一些正在进行的副本完成。当复制请求在队列中时,不显示有关这些复制请求的进度信息。复制开始后即显示进度信息。

限制

复制快照时,存在以下一些限制:

  • 如果您在目标快照可用之前删除了源快照,则快照复制将失败。在删除源快照之前,请确保目标快照的状态为 AVAILABLE

  • 每个账户最多可以同时进行到同一目标区域的五个快照复制请求。

  • 根据所涉及的区域和要复制的数据量,可能需要数小时才能完成跨区域快照复制。有关更多信息,请参阅 跨复制快照 Amazon Web Services 区域

  • Amazon DocumentDB 不支持在中国(北京)(cn-north-1)和中国(宁夏)(cn-northwest-1)区域之间复制集群快照。

处理加密

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

源快照在复制过程中保持加密状态。有关更多信息,请参阅 Amazon DocumentDB 中的数据保护

注意

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

参数组注意事项

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

  1. 在目标中 Amazon Web Services 区域,使用与原始集群相同的设置创建一个 Amazon DocumentDB 集群参数组。如果新版本中已经存在一个 Amazon Web Services 区域,则可以使用那个。

  2. 在目标中恢复快照后 Amazon Web Services 区域,修改新的 Amazon DocumentDB 集群并添加上一步中的新参数组或现有参数组。有关更多信息,请参阅 修改亚马逊文档数据库集群

复制集群快照

您可以使用 Amazon Web Services Management Console 或复制 Amazon DocumentDB 集群 Amazon CLI,如下所示。

Using the Amazon Web Services Management Console

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

  1. 登录并打开亚马逊 DocumentDB 控制台,网址为 https://console.aws.amazon.com/docdb。 Amazon Web Services Management Console

  2. 在导航窗格中,选择快照,然后选择要复制的快照左侧的按钮。

    提示

    如果您在屏幕左侧没有看到导航窗格,请在页面左上角选择菜单图标 ()。

  3. Actions 菜单中,选择 Copy

  4. 在出现的 Make Copy of cluster snapshot(复制集群快照)页面中,完成 Settings(设置)部分。

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

    2. 新快照标识符 — 输入新快照的名称。

      目标快照命名约束:

      • 不能是现有快照的名称。

      • 长度为 [1—63] 个字母、数字或连字符。

      • 第一个字符必须是字母。

      • 不能以连字符结束或包含两个连续连字符。

      • 每个区域的 Amazon RDS、Neptune 和 Amazon DocumentDB 中的所有集群都必须是唯一 Amazon Web Services 账户的。

    3. 复制标签 — 要将您在源快照上拥有的任何标签复制到快照副本,请选择复制标签

  5. 完成 E ncryption-at-rest 部分。

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

      有关对快照副本进行加密的更多信息,请参阅复制集群快照加密

      有关静态加密的更多信息,请参阅 Amazon DocumentDB 静态数据加密

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

  6. 要制作所选快照的副本,请选择 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 格式。 Amazon Web Services 区域此参数不区分大小写。

  • --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,请参阅 CopyDB ClusterSnapshot

  • --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-identifierTargetDBClusterSnapshotIdentifier 标识的目标集群快照。

示例 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" } }

示例 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:111122223333:cluster-snapshot:sample-cluster-snapshot-copy", "SourceDBClusterSnapshotArn": "arn:aws:rds:us-east-1:111122223333:cluster-snapshot:sample-cluster-snapshot", } }

示例 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": "ayhu-xrsc-test-ap-southeast-1-small-cluster-kms", "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:111122223333:key/sample-key-id", "DBClusterSnapshotArn": "arn:aws:rds:us-east-1:111122223333:cluster-snapshot:sample-cluster-snapshot-copy", "SourceDBClusterSnapshotArn": "arn:aws:rds:us-west-2:111122223333:cluster-snapshot:sample-cluster-snapshot", } }
注意

有关对快照副本进行加密的更多信息,请参阅复制集群快照加密

有关静态加密的更多信息,请参阅 Amazon DocumentDB 静态数据加密