

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 跨帳戶複製資料庫叢集快照
<a name="USER_CopyDBClusterSnapshot.CrossAccount"></a>

您可以使用 Amazon RDS API `ModifyDBClusterSnapshotAttribute`和 `CopyDBClusterSnapshot`動作，讓其他 AWS 帳戶複製您指定的資料庫叢集快照。您只能在相同 AWS 區域中跨帳戶複製資料庫叢集快照。跨帳戶複製程序如下所示，其中帳戶 A 提供可複製的快照，而帳戶 B 會複製快照。

1. 使用帳戶 A，呼叫 `ModifyDBClusterSnapshotAttribute`，並在 **restore** 參數中指定 `AttributeName`，在 `ValuesToAdd` 參數中指定帳戶 B 的 ID。

1. (如果快照已加密) 使用帳戶 A，更新 KMS 金鑰的金鑰政策，先將帳戶 B 的 ARN 新增為 `Principal`，然後允許 `kms:CreateGrant` 動作。

1. (如果快照已加密) 使用帳戶 B，選擇或建立使用者，並將 IAM 政策連接到該使用者，以允許使用者以您的 KMS 金鑰來複製已加密的資料庫叢集快照。

1. 使用帳戶 B，呼叫 `CopyDBClusterSnapshot`，並使用 `SourceDBClusterSnapshotIdentifier` 參數來指定要複製之資料庫叢集快照的 ARN，其中必須包含帳戶 A 的 ID。

若要列出允許還原資料庫叢集快照的所有 AWS 帳戶，請使用 [ DescribeDBSnapshotAttributes](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DescribeDBSnapshotAttributes.html) 或 [ DescribeDBClusterSnapshotAttributes](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DescribeDBClusterSnapshotAttributes.html) API 操作。

若要移除 AWS 帳戶的共用許可，請使用 `ModifyDBSnapshotAttribute`或 `ModifyDBClusterSnapshotAttribute`動作，並將 `AttributeName` 設為 `restore`，並在 `ValuesToRemove` 參數中使用要移除的帳戶 ID。

## 將未加密的資料庫叢集快照複製到另一個帳戶
<a name="USER_CopyDBClusterSnapshot.Unencrypted.CrossAccount"></a>

使用下列程序，將未加密的資料庫叢集快照複製至相同 AWS 區域中的另一個帳戶。

1. 在資料庫叢集快照的來源帳戶中，呼叫 `ModifyDBClusterSnapshotAttribute`，並在 **restore** 參數中指定 `AttributeName`，在 `ValuesToAdd` 參數中指定目標帳戶的 ID。

   使用帳戶 `987654321` 執行下列範例，以允許兩個 AWS 帳戶識別符 (`123451234512` 和 `123456789012`) 還原名為 `manual-snapshot1` 的資料庫叢集快照。

   ```
   https://rds.us-west-2.amazonaws.com/
   	?Action=ModifyDBClusterSnapshotAttribute
   	&AttributeName=restore
   	&DBClusterSnapshotIdentifier=manual-snapshot1
   	&SignatureMethod=HmacSHA256&SignatureVersion=4
   	&ValuesToAdd.member.1=123451234512
   	&ValuesToAdd.member.2=123456789012
   	&Version=2014-10-31
   	&X-Amz-Algorithm=AWS4-HMAC-SHA256
   	&X-Amz-Credential=AKIADQKE4SARGYLE/20150922/us-west-2/rds/aws4_request
   	&X-Amz-Date=20150922T220515Z
   	&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
   	&X-Amz-Signature=ef38f1ce3dab4e1dbf113d8d2a265c67d17ece1999ffd36be85714ed36dddbb3
   ```

1. 在目標帳戶中，呼叫 `CopyDBClusterSnapshot`，並使用 `SourceDBClusterSnapshotIdentifier` 參數來指定要複製之資料庫叢集快照的 ARN，其中必須包含來源帳戶的 ID。

   使用帳戶 `123451234512` 執行下列範例，以便從帳戶 `aurora-cluster1-snapshot-20130805` 複製資料庫叢集快照 `987654321`，並建立名為 `dbclustersnapshot1` 的資料庫叢集快照。

   ```
   https://rds.us-west-2.amazonaws.com/
      ?Action=CopyDBClusterSnapshot
      &CopyTags=true
      &SignatureMethod=HmacSHA256
      &SignatureVersion=4
      &SourceDBClusterSnapshotIdentifier=arn:aws:rds:us-west-2:987654321:cluster-snapshot:aurora-cluster1-snapshot-20130805
      &TargetDBClusterSnapshotIdentifier=dbclustersnapshot1
      &Version=2013-09-09
      &X-Amz-Algorithm=AWS4-HMAC-SHA256
      &X-Amz-Credential=AKIADQKE4SARGYLE/20150922/us-west-2/rds/aws4_request
      &X-Amz-Date=20140429T175351Z
      &X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
      &X-Amz-Signature=9164337efa99caf850e874a1cb7ef62f3cea29d0b448b9e0e7c53b288ddffed2
   ```

## 將已加密的資料庫叢集快照複製到另一個帳戶
<a name="USER_CopyDBClusterSnapshot.Encrypted.CrossAccount"></a>

使用下列程序，將已加密的資料庫叢集快照複製至相同 AWS 區域中的另一個帳戶。

1. 在資料庫叢集快照的來源帳戶中，呼叫 `ModifyDBClusterSnapshotAttribute`，並在 **restore** 參數中指定 `AttributeName`，在 `ValuesToAdd` 參數中指定目標帳戶的 ID。

   使用 帳戶執行下列範例，`987654321`允許兩個 AWS 帳戶識別符 `123451234512`和 `123456789012`還原名為 的資料庫叢集快照`manual-snapshot1`。

   ```
   https://rds.us-west-2.amazonaws.com/
   	?Action=ModifyDBClusterSnapshotAttribute
   	&AttributeName=restore
   	&DBClusterSnapshotIdentifier=manual-snapshot1
   	&SignatureMethod=HmacSHA256&SignatureVersion=4
   	&ValuesToAdd.member.1=123451234512
   	&ValuesToAdd.member.2=123456789012
   	&Version=2014-10-31
   	&X-Amz-Algorithm=AWS4-HMAC-SHA256
   	&X-Amz-Credential=AKIADQKE4SARGYLE/20150922/us-west-2/rds/aws4_request
   	&X-Amz-Date=20150922T220515Z
   	&X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
   	&X-Amz-Signature=ef38f1ce3dab4e1dbf113d8d2a265c67d17ece1999ffd36be85714ed36dddbb3
   ```

1. 在資料庫叢集快照的來源帳戶中，在 AWS 區域 與加密資料庫叢集快照相同的 中建立自訂 KMS 金鑰。建立客戶自管金鑰時，您可以提供目標 AWS 帳戶的存取權。如需詳細資訊，請參閱[建立客戶自管金鑰並授予存取權](share-encrypted-snapshot.md#share-encrypted-snapshot.cmk)。

1. 將快照複製到目標 AWS 帳戶並共用。如需詳細資訊，請參閱[從來源帳戶複製和共用快照](share-encrypted-snapshot.md#share-encrypted-snapshot.share)。

1. 在目標帳戶中，呼叫 `CopyDBClusterSnapshot`，並使用 `SourceDBClusterSnapshotIdentifier` 參數來指定要複製之資料庫叢集快照的 ARN，其中必須包含來源帳戶的 ID。

   使用帳戶 `123451234512` 執行下列範例，以便從帳戶 `aurora-cluster1-snapshot-20130805` 複製資料庫叢集快照 `987654321`，並建立名為 `dbclustersnapshot1` 的資料庫叢集快照。

   ```
   https://rds.us-west-2.amazonaws.com/
      ?Action=CopyDBClusterSnapshot
      &CopyTags=true
      &SignatureMethod=HmacSHA256
      &SignatureVersion=4
      &SourceDBClusterSnapshotIdentifier=arn:aws:rds:us-west-2:987654321:cluster-snapshot:aurora-cluster1-snapshot-20130805
      &TargetDBClusterSnapshotIdentifier=dbclustersnapshot1
      &Version=2013-09-09
      &X-Amz-Algorithm=AWS4-HMAC-SHA256
      &X-Amz-Credential=AKIADQKE4SARGYLE/20150922/us-west-2/rds/aws4_request
      &X-Amz-Date=20140429T175351Z
      &X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date
      &X-Amz-Signature=9164337efa99caf850e874a1cb7ef62f3cea29d0b448b9e0e7c53b288ddffed2
   ```