Cloning a volume for an Amazon Aurora DB cluster - Amazon Aurora
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Cloning a volume for an Amazon Aurora DB cluster

By using Aurora cloning, you can create a new cluster that initially shares the same data pages as the original, but is a separate and independent volume. The process is designed to be fast and cost-effective. The new cluster with its associated data volume is known as a clone. Creating a clone is faster and more space-efficient than physically copying the data using other techniques, such as restoring a snapshot.

Overview of Aurora cloning

Aurora uses a copy-on-write protocol to create a clone. This mechanism uses minimal additional space to create an initial clone. When the clone is first created, Aurora keeps a single copy of the data that is used by the source Aurora DB cluster and the new (cloned) Aurora DB cluster. Additional storage is allocated only when changes are made to data (on the Aurora storage volume) by the source Aurora DB cluster or the Aurora DB cluster clone. To learn more about the copy-on-write protocol, see How Aurora cloning works.

Aurora cloning is especially useful for quickly setting up test environments using your production data, without risking data corruption. You can use clones for many types of applications, such as the following:

  • Experiment with potential changes (schema changes and parameter group changes, for example) to assess all impacts.

  • Run workload-intensive operations, such as exporting data or running analytical queries on the clone.

  • Create a copy of your production DB cluster for development, testing, or other purposes.

You can create more than one clone from the same Aurora DB cluster. You can also create multiple clones from another clone.

After creating an Aurora clone, you can configure the Aurora DB instances differently from the source Aurora DB cluster. For example, you might not need a clone for development purposes to meet the same high availability requirements as the source production Aurora DB cluster. In this case, you can configure the clone with a single Aurora DB instance rather than the multiple DB instances used by the Aurora DB cluster.

When you create a clone using a different deployment configuration from the source, the clone is created using the latest minor version of the source's Aurora DB engine.

When you create clones from your Aurora DB clusters, the clones are created in your Amazon account—the same account that owns the source Aurora DB cluster. However, you can also share Aurora Serverless v2 and provisioned Aurora DB clusters and clones with other Amazon accounts. For more information, see Cross-account cloning with Amazon RAM and Amazon Aurora.

When you finish using the clone for your testing, development, or other purposes, you can delete it.

Limitations of Aurora cloning

Aurora cloning currently has the following limitations:

  • You can create as many clones as you want, up to the maximum number of DB clusters allowed in the Amazon Web Services Region.

    You can create the clones using the copy-on-write protocol or the full-copy protocol. The full-copy protocol acts like a point-in-time recovery.

  • You can't create a clone in a different Amazon Region from the source Aurora DB cluster.

  • You can't create a clone from an Aurora DB cluster without the parallel query feature to a cluster that uses parallel query. To bring data into a cluster that uses parallel query, create a snapshot of the original cluster and restore it to the cluster that's using the parallel query feature.

  • You can't create a clone from an Aurora DB cluster that has no DB instances. You can only clone Aurora DB clusters that have at least one DB instance.

  • You can create a clone in a different virtual private cloud (VPC) than that of the Aurora DB cluster. If you do, the subnets of the VPCs must map to the same Availability Zones.

  • You can create an Aurora provisioned clone from a provisioned Aurora DB cluster.

  • Clusters with Aurora Serverless v2 instances follow the same rules as provisioned clusters.

  • For Aurora Serverless v1:

    • You can create a provisioned clone from an Aurora Serverless v1 DB cluster.

    • You can create an Aurora Serverless v1 clone from an Aurora Serverless v1 or provisioned DB cluster.

    • You can't create an Aurora Serverless v1 clone from an unencrypted, provisioned Aurora DB cluster.

    • Cross-account cloning currently doesn't support cloning Aurora Serverless v1 DB clusters. For more information, see Limitations of cross-account cloning.

    • A cloned Aurora Serverless v1 DB cluster has the same behavior and limitations as any Aurora Serverless v1 DB cluster. For more information, see Using Amazon Aurora Serverless v1.

    • Aurora Serverless v1 DB clusters are always encrypted. When you clone an Aurora Serverless v1 DB cluster into a provisioned Aurora DB cluster, the provisioned Aurora DB cluster is encrypted. You can choose the encryption key, but you can't disable the encryption. To clone from a provisioned Aurora DB cluster to an Aurora Serverless v1, you must start with an encrypted provisioned Aurora DB cluster.

How Aurora cloning works

Aurora cloning works at the storage layer of an Aurora DB cluster. It uses a copy-on-write protocol that's both fast and space-efficient in terms of the underlying durable media supporting the Aurora storage volume. You can learn more about Aurora cluster volumes in the Overview of Amazon Aurora storage.

Understanding the copy-on-write protocol

An Aurora DB cluster stores data in pages in the underlying Aurora storage volume.

For example, in the following diagram you can find an Aurora DB cluster (A) that has four data pages, 1, 2, 3, and 4. Imagine that a clone, B, is created from the Aurora DB cluster. When the clone is created, no data is copied. Rather, the clone points to the same set of pages as the source Aurora DB cluster.


                    Amazon Aurora cluster volume with 4 pages for source cluster, A, and clone, B

When the clone is created, no additional storage is usually needed. The copy-on-write protocol uses the same segment on the physical storage media as the source segment. Additional storage is required only if the capacity of the source segment isn't sufficient for the entire clone segment. If that's the case, the source segment is copied to another physical device.

In the following diagrams, you can find an example of the copy-on-write protocol in action using the same cluster A and its clone, B, as shown preceding. Let's say that you make a change to your Aurora DB cluster (A) that results in a change to data held on page 1. Instead of writing to the original page 1, Aurora creates a new page 1[A]. The Aurora DB cluster volume for cluster (A) now points to page 1[A], 2, 3, and 4, while the clone (B) still references the original pages.


              Amazon Aurora source DB cluster volume and its clone, both with changes.

On the clone, a change is made to page 4 on the storage volume. Instead of writing to the original page 4, Aurora creates a new page, 4[B]. The clone now points to pages 1, 2, 3, and to page 4[B], while the cluster (A) continues pointing to 1[A], 2, 3, and 4.


        Amazon Aurora source DB cluster volume and its clone, both with changes.

As more changes occur over time in both the source Aurora DB cluster volume and the clone, more storage is needed to capture and store the changes.

Deleting a source cluster volume

When you delete a source cluster volume that has one or more clones associated with it, the clones aren't affected. The clones continue to point to the pages that were previously owned by the source cluster volume.

Creating an Amazon Aurora clone

You can create a clone in the same Amazon account as the source Aurora DB cluster. To do so, you can use the Amazon Web Services Management Console or the Amazon CLI and the procedures following.

To allow another Amazon account to create a clone or to share a clone with another Amazon account, use the procedures in Cross-account cloning with Amazon RAM and Amazon Aurora.

The following procedure describes how to clone an Aurora DB cluster using the Amazon Web Services Management Console.

Creating a clone using the Amazon Web Services Management Console results in an Aurora DB cluster with one Aurora DB instance.

These instructions apply for DB clusters owned by the same Amazon account that is creating the clone. If the DB cluster is owned by a different Amazon account, see Cross-account cloning with Amazon RAM and Amazon Aurora instead.

To create a clone of a DB cluster owned by your Amazon account using the Amazon Web Services Management Console
  1. Sign in to the Amazon Web Services Management Console and open the Amazon RDS console at https://console.amazonaws.cn/rds/.

  2. In the navigation pane, choose Databases.

  3. Choose your Aurora DB cluster from the list, and for Actions, choose Create clone.

    
                  Creating a clone starts by selecting your Aurora DB cluster.

    The Create clone page opens, where you can configure Settings, Connectivity, and other options for the Aurora DB cluster clone.

  4. For DB instance identifier, enter the name that you want to give to your cloned Aurora DB cluster.

  5. For Aurora Serverless v1 DB clusters, choose Provisioned or Serverless for Capacity type.

    You can choose Serverless only if the source Aurora DB cluster is an Aurora Serverless v1 DB cluster or is a provisioned Aurora DB cluster that is encrypted.

  6. For Aurora Serverless v2 or provisioned DB clusters, choose either Aurora I/O-Optimized or Aurora Standard for Cluster storage configuration.

    For more information, see Storage configurations for Amazon Aurora DB clusters.

  7. Choose the DB instance size or DB cluster capacity:

    • For a provisioned clone, choose a DB instance class.

      
                                        To create a provisioned clone, specify the DB instance size.

      You can accept the provided setting, or you can use a different DB instance class for your clone.

    • For an Aurora Serverless v1 or Aurora Serverless v2 clone, choose the Capacity settings.

      
                                        To create a Serverless clone from an Aurora DB cluster, specify the
                                            capacity.

      You can accept the provided settings, or you can change them for your clone.

  8. Choose other settings as needed for your clone. To learn more about Aurora DB cluster and instance settings, see Creating an Amazon Aurora DB cluster.

  9. Choose Create clone.

When the clone is created, it's listed with your other Aurora DB clusters in the console Databases section and displays its current state. Your clone is ready to use when its state is Available.

Using the Amazon CLI for cloning your Aurora DB cluster involves a couple of steps.

The restore-db-cluster-to-point-in-time Amazon CLI command that you use results in an empty Aurora DB cluster with 0 Aurora DB instances. That is, the command restores only the Aurora DB cluster, not the DB instances for that cluster. You do that separately after the clone is available. The two steps in the process are as follows:

  1. Create the clone by using the restore-db-cluster-to-point-in-time CLI command. The parameters that you use with this command control the capacity type and other details of the empty Aurora DB cluster (clone) being created.

  2. Create the Aurora DB instance for the clone by using the create-db-instance CLI command to recreate the Aurora DB instance in the restored Aurora DB cluster.

Creating the clone

The specific parameters that you pass to the restore-db-cluster-to-point-in-time CLI command vary. What you pass depends on the engine-mode type of the source DB cluster—Serverless or Provisioned—and the type of clone that you want to create.

To create a clone of the same engine mode as the source Aurora DB cluster
  • Use the restore-db-cluster-to-point-in-time CLI command and specify values for the following parameters:

    • --db-cluster-identifier – Choose a meaningful name for your clone. You name the clone when you use the restore-db-cluster-to-point-in-time CLI command. You then pass the name of the clone in the create-db-instance CLI command.

    • --restore-type – Use copy-on-write to create a clone of the source DB cluster. Without this parameter, the restore-db-cluster-to-point-in-time restores the Aurora DB cluster rather than creating a clone.

    • --source-db-cluster-identifier – Use the name of the source Aurora DB cluster that you want to clone.

    • --use-latest-restorable-time – This value points to the latest restorable volume data for the source DB cluster. Use it to create clones.

The following example creates a clone named my-clone from a cluster named my-source-cluster.

For Linux, macOS, or Unix:

aws rds restore-db-cluster-to-point-in-time \ --source-db-cluster-identifier my-source-cluster \ --db-cluster-identifier my-clone \ --restore-type copy-on-write \ --use-latest-restorable-time

For Windows:

aws rds restore-db-cluster-to-point-in-time ^ --source-db-cluster-identifier my-source-cluster ^ --db-cluster-identifier my-clone ^ --restore-type copy-on-write ^ --use-latest-restorable-time

The command returns the JSON object containing details of the clone. Check to make sure that your cloned DB cluster is available before trying to create the DB instance for your clone. For more information, see Checking the status and getting clone details.

To create a clone with a different engine mode from the source Aurora DB cluster
  • Use the restore-db-cluster-to-point-in-time CLI command and specify values for the following parameters:

    • --db-cluster-identifier – Choose a meaningful name for your clone. You name the clone when you use the restore-db-cluster-to-point-in-time CLI command. You then pass the name of the clone in the create-db-instance CLI command.

    • --source-db-cluster-identifier – Use the name of the source Aurora DB cluster that you want to clone.

    • --restore-type – Use copy-on-write to create a clone of the source DB cluster. Without this parameter, the restore-db-cluster-to-point-in-time restores the Aurora DB cluster rather than creating a clone.

    • --use-latest-restorable-time – This value points to the latest restorable volume data for the source DB cluster. Use it to create clones.

    • --engine-mode – (Optional) Use this parameter only to create clones that are of a different type from the source Aurora DB cluster. Choose the value to pass with --engine-mode as follows:

      • Use provisioned to create a provisioned Aurora DB cluster clone from an Aurora Serverless DB cluster.

      • Use serverless to create an Aurora Serverless v1 DB cluster clone from a provisioned Aurora DB cluster. When you specify the serverless engine mode, you can also choose the --scaling-configuration.

    • --scaling-configuration – (Optional) Use with --engine-mode serverless to configure the minimum and maximum capacity for an Aurora Serverless v1 clone. If you don't use this parameter, Aurora creates the clone using the default capacity values for the DB engine.

    • --serverless-v2-scaling-configuration – (Optional) Use this parameter to configure the minimum and maximum capacity for an Aurora Serverless v2 clone. If you don't use this parameter, Aurora creates the clone using the default capacity values for the DB engine.

The following example creates an Aurora Serverless v1 clone named my-clone, from a provisioned Aurora DB cluster named my-source-cluster. The provisioned Aurora DB cluster is encrypted.

For Linux, macOS, or Unix:

aws rds restore-db-cluster-to-point-in-time \ --source-db-cluster-identifier my-source-cluster \ --db-cluster-identifier my-clone \ --engine-mode serverless \ --scaling-configuration MinCapacity=8,MaxCapacity=64 \ --restore-type copy-on-write \ --use-latest-restorable-time

For Windows:

aws rds restore-db-cluster-to-point-in-time ^ --source-db-cluster-identifier my-source-cluster ^ --db-cluster-identifier my-clone ^ --engine-mode serverless ^ --scaling-configuration MinCapacity=8,MaxCapacity=64 ^ --restore-type copy-on-write ^ --use-latest-restorable-time

These commands return the JSON object containing details of the clone that you need to create the DB instance. You can't do that until the status of the clone (the empty Aurora DB cluster) has the status Available.

Note

The restore-db-cluster-to-point-in-time Amazon CLI command only restores the DB cluster, not the DB instances for that DB cluster. You must invoke the create-db-instance command to create DB instances for the restored DB cluster, specifying the identifier of the restored DB cluster in --db-cluster-identifier. You can create DB instances only after the restore-db-cluster-to-point-in-time command has completed and the DB cluster is available.

For example, suppose you have a cluster named tpch100g that you want to clone. The following Linux example creates a cloned cluster named tpch100g-clone and a primary instance named tpch100g-clone-instance for the new cluster. You don't need to supply some parameters, such as --master-username and --master-user-password. Aurora automatically determines those from the original cluster. You do need to specify the DB engine to use. Thus, the example tests the new cluster to determine the right value to use for the --engine parameter.

$ aws rds restore-db-cluster-to-point-in-time \ --source-db-cluster-identifier tpch100g \ --db-cluster-identifier tpch100g-clone \ --restore-type copy-on-write \ --use-latest-restorable-time $ aws rds describe-db-clusters \ --db-cluster-identifier tpch100g-clone \ --query '*[].[Engine]' \ --output text aurora-mysql $ aws rds create-db-instance \ --db-instance-identifier tpch100g-clone-instance \ --db-cluster-identifier tpch100g-clone \ --db-instance-class db.r5.4xlarge \ --engine aurora-mysql

Checking the status and getting clone details

You can use the following command to check the status of your newly created empty DB cluster.

$ aws rds describe-db-clusters --db-cluster-identifier my-clone --query '*[].[Status]' --output text

Or you can obtain the status and the other values that you need to create the DB instance for your clone by using the following Amazon CLI query.

For Linux, macOS, or Unix:

aws rds describe-db-clusters --db-cluster-identifier my-clone \ --query '*[].{Status:Status,Engine:Engine,EngineVersion:EngineVersion,EngineMode:EngineMode}'

For Windows:

aws rds describe-db-clusters --db-cluster-identifier my-clone ^ --query "*[].{Status:Status,Engine:Engine,EngineVersion:EngineVersion,EngineMode:EngineMode}"

This query returns output similar to the following.

[ { "Status": "available", "Engine": "aurora-mysql", "EngineVersion": "8.0.mysql_aurora.3.04.1", "EngineMode": "provisioned" } ]

Creating the Aurora DB instance for your clone

Use the create-db-instance CLI command to create the DB instance for your Aurora Serverless v2 or provisioned clone. You don't create a DB instance for an Aurora Serverless v1 clone.

The DB instance inherits the --master-username and --master-user-password properties from the source DB cluster.

The following example creates a DB instance for a provisioned clone.

For Linux, macOS, or Unix:

aws rds create-db-instance \ --db-instance-identifier my-new-db \ --db-cluster-identifier my-clone \ --db-instance-class db.r5.4xlarge \ --engine aurora-mysql

For Windows:

aws rds create-db-instance ^ --db-instance-identifier my-new-db ^ --db-cluster-identifier my-clone ^ --db-instance-class db.r5.4xlarge ^ --engine aurora-mysql

Parameters to use for cloning

The following table summarizes the various parameters used with restore-db-cluster-to-point-in-time to clone Aurora DB clusters.

Parameter Description

--source-db-cluster-identifier

Use the name of the source Aurora DB cluster that you want to clone.

--db-cluster-identifier

Choose a meaningful name for your clone when you create it with the restore-db-cluster-to-point-in-time command. Then you pass this name to the create-db-instance command.

--restore-type

Specify copy-on-write as the --restore-type to create a clone of the source DB cluster rather than restoring the source Aurora DB cluster.

--use-latest-restorable-time

This value points to the latest restorable volume data for the source DB cluster. Use it to create clones.

--engine-mode

Use this parameter to create clones that are of a different type from the source Aurora DB cluster, with one of the following values:

  • Use provisioned to create a provisioned or Aurora Serverless v2 clone from an Aurora Serverless v1 DB cluster.

  • Use serverless to create an Aurora Serverless v1 clone from a provisioned or Aurora Serverless v2 DB cluster.

    When you specify the serverless engine mode, you can also choose the --scaling-configuration.

--scaling-configuration

Use this parameter to configure the minimum and maximum capacity for an Aurora Serverless v1 clone. If you don't specify this parameter, Aurora creates the clone using the default capacity values for the DB engine.

--serverless-v2-scaling-configuration

Use this parameter to configure the minimum and maximum capacity for an Aurora Serverless v2 clone. If you don't specify this parameter, Aurora creates the clone using the default capacity values for the DB engine.

Cross-account cloning with Amazon RAM and Amazon Aurora

By using Amazon Resource Access Manager (Amazon RAM) with Amazon Aurora, you can share Aurora DB clusters and clones that belong to your Amazon account with another Amazon account or organization. Such cross-account cloning is much faster than creating and restoring a database snapshot. You can create a clone of one of your Aurora DB clusters and share the clone. Or you can share your Aurora DB cluster with another Amazon account and let the account holder create the clone. The approach that you choose depends on your use case.

For example, you might need to regularly share a clone of your financial database with your organization's internal auditing team. In this case, your auditing team has its own Amazon account for the applications that it uses. You can give the auditing team's Amazon account the permission to access your Aurora DB cluster and clone it as needed.

On the other hand, if an outside vendor audits your financial data you might prefer to create the clone yourself. You then give the outside vendor access to the clone only.

You can also use cross-account cloning to support many of the same use cases for cloning within the same Amazon account, such as development and testing. For example, your organization might use different Amazon accounts for production, development, testing, and so on. For more information, see Overview of Aurora cloning.

Thus, you might want to share a clone with another Amazon account or allow another Amazon account to create clones of your Aurora DB clusters. In either case, start by using Amazon RAM to create a share object. For complete information about sharing Amazon resources between Amazon accounts, see the Amazon RAM User Guide.

Creating a cross-account clone requires actions from the Amazon account that owns the original cluster, and the Amazon account that creates the clone. First, the original cluster owner modifies the cluster to allow one or more other accounts to clone it. If any of the accounts is in a different Amazon organization, Amazon generates a sharing invitation. The other account must accept the invitation before proceeding. Then each authorized account can clone the cluster. Throughout this process, the cluster is identified by its unique Amazon Resource Name (ARN).

As with cloning within the same Amazon account, additional storage space is used only if changes are made to the data by the source or the clone. Charges for storage are then applied at that time. If the source cluster is deleted, storage costs are distributed equally among remaining cloned clusters.

Limitations of cross-account cloning

Aurora cross-account cloning has the following limitations:

  • You can't clone an Aurora Serverless v1 cluster across Amazon accounts.

  • You can't view or accept invitations to shared resources with the Amazon Web Services Management Console. Use the Amazon CLI, the Amazon RDS API, or the Amazon RAM console to view and accept invitations to shared resources.

  • You can create only one new clone from a clone that's been shared with your Amazon account.

  • You can't share resources (clones or Aurora DB clusters) that have been shared with your Amazon account.

  • You can create a maximum of 15 cross-account clones from any single Aurora DB cluster.

  • Each of the 15 cross-account clones must be owned by a different Amazon account. That is, you can only create one cross-account clone of a cluster within any Amazon account.

  • After you clone a cluster, the original cluster and its clone are considered to be the same for purposes of enforcing limits on cross-account clones. You can't create cross-account clones of both the original cluster and the cloned cluster within the same Amazon account. The total number of cross-account clones for the original cluster and any of its clones can't exceed 15.

  • You can't share an Aurora DB cluster with other Amazon accounts unless the cluster is in an ACTIVE state.

  • You can't rename an Aurora DB cluster that's been shared with other Amazon accounts.

  • You can't create a cross-account clone of a cluster that is encrypted with the default RDS key.

  • You can't create nonencrypted clones in one Amazon account from encrypted Aurora DB clusters that have been shared by another Amazon account. The cluster owner must grant permission to access the source cluster's Amazon KMS key. However, you can use a different key when you create the clone.

Allowing other Amazon accounts to clone your cluster

To allow other Amazon accounts to clone a cluster that you own, use Amazon RAM to set the sharing permission. Doing so also sends an invitation to each of the other accounts that's in a different Amazon organization.

For the procedures to share resources owned by you in the Amazon RAM console, see Sharing resources owned by you in the Amazon RAM User Guide.

Granting permission to other Amazon accounts to clone your cluster

If the cluster that you're sharing is encrypted, you also share the Amazon KMS key for the cluster. You can allow Amazon Identity and Access Management (IAM) users or roles in one Amazon account to use a KMS key in a different account.

To do this, you first add the external account (root user) to the KMS key's key policy through Amazon KMS. You don't add the individual users or roles to the key policy, only the external account that owns them. You can only share a KMS key that you create, not the default RDS service key. For information about access control for KMS keys, see Authentication and access control for Amazon KMS.

To grant permission to clone your cluster
  1. Sign in to the Amazon Web Services Management Console and open the Amazon RDS console at https://console.amazonaws.cn/rds/.

  2. In the navigation pane, choose Databases.

  3. Choose the DB cluster that you want to share to see its Details page, and choose the Connectivity & security tab.

  4. In the Share DB cluster with other Amazon accounts section, enter the numeric account ID for the Amazon account that you want to allow to clone this cluster. For account IDs in the same organization, you can begin typing in the box and then choose from the menu.

    Important

    In some cases, you might want an account that is not in the same Amazon organization as your account to clone a cluster. In these cases, for security reasons the console doesn't report who owns that account ID or whether the account exists.

    Be careful entering account numbers that are not in the same Amazon organization as your Amazon account. Immediately verify that you shared with the intended account.

  5. On the confirmation page, verify that the account ID that you specified is correct. Enter share in the confirmation box to confirm.

    On the Details page, an entry appears that shows the specified Amazon account ID under Accounts that this DB cluster is shared with. The Status column initially shows a status of Pending.

  6. Contact the owner of the other Amazon account, or sign in to that account if you own both of them. Instruct the owner of the other account to accept the sharing invitation and clone the DB cluster, as described following.

To grant permission to clone your cluster
  1. Gather the information for the required parameters. You need the ARN for your cluster and the numeric ID for the other Amazon account.

  2. Run the Amazon RAM CLI command create-resource-share.

    For Linux, macOS, or Unix:

    aws ram create-resource-share --name descriptive_name \ --region region \ --resource-arns cluster_arn \ --principals other_account_ids

    For Windows:

    aws ram create-resource-share --name descriptive_name ^ --region region ^ --resource-arns cluster_arn ^ --principals other_account_ids

    To include multiple account IDs for the --principals parameter, separate IDs from each other with spaces. To specify whether the permitted account IDs can be outside your Amazon organization, include the --allow-external-principals or --no-allow-external-principals parameter for create-resource-share.

To grant permission to clone your cluster
  1. Gather the information for the required parameters. You need the ARN for your cluster and the numeric ID for the other Amazon account.

  2. Call the Amazon RAM API operation CreateResourceShare, and specify the following values:

    • Specify the account ID for one or more Amazon accounts as the principals parameter.

    • Specify the ARN for one or more Aurora DB clusters as the resourceArns parameter.

    • Specify whether the permitted account IDs can be outside your Amazon organization by including a Boolean value for the allowExternalPrincipals parameter.

Recreating a cluster that uses the default RDS key

If the encrypted cluster that you plan to share uses the default RDS key, make sure to recreate the cluster. To do this, create a manual snapshot of your DB cluster, use an Amazon KMS key, and then restore the cluster to a new cluster. Then share the new cluster. To perform this process, take the following steps.

To recreate an encrypted cluster that uses the default RDS key
  1. Sign in to the Amazon Web Services Management Console and open the Amazon RDS console at https://console.amazonaws.cn/rds/.

  2. Choose Snapshots from the navigation pane.

  3. Choose your snapshot.

  4. For Actions, choose Copy Snapshot, and then choose Enable encryption.

  5. For Amazon KMS key, choose the new encryption key that you want to use.

  6. Restore the copied snapshot. To do so, follow the procedure in Restoring from a DB cluster snapshot. The new DB instance uses your new encryption key.

  7. (Optional) Delete the old DB cluster if you no longer need it. To do so, follow the procedure in Deleting a DB cluster snapshot. Before you do, confirm that your new cluster has all necessary data and that your application can access it successfully.

Checking if a cluster that you own is shared with other Amazon accounts

You can check if other users have permission to share a cluster. Doing so can help you understand whether the cluster is approaching the limit for the maximum number of cross-account clones.

For the procedures to share resources using the Amazon RAM console, see Sharing resources owned by you in the Amazon RAM User Guide.

To find out if a cluster that you own is shared with other Amazon accounts
  • Call the Amazon RAM CLI command list-principals, using your account ID as the resource owner and the ARN of your cluster as the resource ARN. You can see all shares with the following command. The results indicate which Amazon accounts are allowed to clone the cluster.

    aws ram list-principals \ --resource-arns your_cluster_arn \ --principals your_aws_id
To find out if a cluster that you own is shared with other Amazon accounts
  • Call the Amazon RAM API operation ListPrincipals. Use your account ID as the resource owner and the ARN of your cluster as the resource ARN.

Cloning a cluster that is owned by another Amazon account

To clone a cluster that's owned by another Amazon account, use Amazon RAM to get permission to make the clone. After you have the required permission, use the standard procedure for cloning an Aurora cluster.

You can also check whether a cluster that you own is a clone of a cluster owned by a different Amazon account.

For the procedures to work with resources owned by others in the Amazon RAM console, see Accessing resources shared with you in the Amazon RAM User Guide.

Viewing invitations to clone clusters that are owned by other Amazon accounts

To work with invitations to clone clusters owned by Amazon accounts in other Amazon organizations, use the Amazon CLI, the Amazon RAM console, or the Amazon RAM API. Currently, you can't perform this procedure using the Amazon RDS console.

For the procedures to work with invitations in the Amazon RAM console, see Accessing resources shared with you in the Amazon RAM User Guide.

To see invitations to clone clusters that are owned by other Amazon accounts
  1. Run the Amazon RAM CLI command get-resource-share-invitations.

    aws ram get-resource-share-invitations --region region_name

    The results from the preceding command show all invitations to clone clusters, including any that you already accepted or rejected.

  2. (Optional) Filter the list so you see only the invitations that require action from you. To do so, add the parameter --query 'resourceShareInvitations[?status==`PENDING`]'.

To see invitations to clone clusters that are owned by other Amazon accounts
  1. Call the Amazon RAM API operation GetResourceShareInvitations. This operation returns all such invitations, including any that you already accepted or rejected.

  2. (Optional) Find only the invitations that require action from you by checking the resourceShareAssociations return field for a status value of PENDING.

Accepting invitations to share clusters owned by other Amazon accounts

You can accept invitations to share clusters owned by other Amazon accounts that are in different Amazon organizations. To work with these invitations, use the Amazon CLI, the Amazon RAM and RDS APIs, or the Amazon RAM console. Currently, you can't perform this procedure using the RDS console.

For the procedures to work with invitations in the Amazon RAM console, see Accessing resources shared with you in the Amazon RAM User Guide.

To accept an invitation to share a cluster from another Amazon account
  1. Find the invitation ARN by running the Amazon RAM CLI command get-resource-share-invitations, as shown preceding.

  2. Accept the invitation by calling the Amazon RAM CLI command accept-resource-share-invitation, as shown following.

    For Linux, macOS, or Unix:

    aws ram accept-resource-share-invitation \ --resource-share-invitation-arn invitation_arn \ --region region

    For Windows:

    aws ram accept-resource-share-invitation ^ --resource-share-invitation-arn invitation_arn ^ --region region
To accept invitations to share somebody's cluster
  1. Find the invitation ARN by calling the Amazon RAM API operation GetResourceShareInvitations, as shown preceding.

  2. Pass that ARN as the resourceShareInvitationArn parameter to the RDS API operation AcceptResourceShareInvitation.

Cloning an Aurora cluster that is owned by another Amazon account

After you accept the invitation from the Amazon account that owns the DB cluster, as shown preceding, you can clone the cluster.

To clone an Aurora cluster that is owned by another Amazon account
  1. Sign in to the Amazon Web Services Management Console and open the Amazon RDS console at https://console.amazonaws.cn/rds/.

  2. In the navigation pane, choose Databases.

    At the top of the database list, you should see one or more items with a Role value of Shared from account #account_id. For security reasons, you can only see limited information about the original clusters. The properties that you can see are the ones such as database engine and version that must be the same in your cloned cluster.

  3. Choose the cluster that you intend to clone.

  4. For Actions, choose Create clone.

  5. Follow the procedure in Console to finish setting up the cloned cluster.

  6. As needed, enable encryption for the cloned cluster. If the cluster that you are cloning is encrypted, you must enable encryption for the cloned cluster. The Amazon account that shared the cluster with you must also share the KMS key that was used to encrypt the cluster. You can use the same KMS key to encrypt the clone, or your own KMS key. You can't create a cross-account clone for a cluster that is encrypted with the default KMS key.

    The account that owns the encryption key must grant permission to use the key to the destination account by using a key policy. This process is similar to how encrypted snapshots are shared, by using a key policy that grants permission to the destination account to use the key.

To clone an Aurora cluster owned by another Amazon account
  1. Accept the invitation from the Amazon account that owns the DB cluster, as shown preceding.

  2. Clone the cluster by specifying the full ARN of the source cluster in the source-db-cluster-identifier parameter of the RDS CLI command restore-db-cluster-to-point-in-time, as shown following.

    If the ARN passed as the source-db-cluster-identifier hasn't been shared, the same error is returned as if the specified cluster doesn't exist.

    For Linux, macOS, or Unix:

    aws rds restore-db-cluster-to-point-in-time \ --source-db-cluster-identifier=arn:aws-cn:rds:arn_details \ --db-cluster-identifier=new_cluster_id \ --restore-type=copy-on-write \ --use-latest-restorable-time

    For Windows:

    aws rds restore-db-cluster-to-point-in-time ^ --source-db-cluster-identifier=arn:aws-cn:rds:arn_details ^ --db-cluster-identifier=new_cluster_id ^ --restore-type=copy-on-write ^ --use-latest-restorable-time
  3. If the cluster that you are cloning is encrypted, encrypt your cloned cluster by including a kms-key-id parameter. This kms-key-id value can be the same one used to encrypt the original DB cluster, or your own KMS key. Your account must have permission to use that encryption key.

    For Linux, macOS, or Unix:

    aws rds restore-db-cluster-to-point-in-time \ --source-db-cluster-identifier=arn:aws-cn:rds:arn_details \ --db-cluster-identifier=new_cluster_id \ --restore-type=copy-on-write \ --use-latest-restorable-time \ --kms-key-id=arn:aws-cn:kms:arn_details

    For Windows:

    aws rds restore-db-cluster-to-point-in-time ^ --source-db-cluster-identifier=arn:aws-cn:rds:arn_details ^ --db-cluster-identifier=new_cluster_id ^ --restore-type=copy-on-write ^ --use-latest-restorable-time ^ --kms-key-id=arn:aws-cn:kms:arn_details

    The account that owns the encryption key must grant permission to use the key to the destination account by using a key policy. This process is similar to how encrypted snapshots are shared, by using a key policy that grants permission to the destination account to use the key. An example of a key policy follows.

    { "Id": "key-policy-1", "Version": "2012-10-17", "Statement": [ { "Sid": "Allow use of the key", "Effect": "Allow", "Principal": {"AWS": [ "arn:aws-cn:iam::account_id:user/KeyUser", "arn:aws-cn:iam::account_id:root" ]}, "Action": [ "kms:CreateGrant", "kms:Encrypt", "kms:Decrypt", "kms:ReEncrypt*", "kms:GenerateDataKey*", "kms:DescribeKey" ], "Resource": "*" }, { "Sid": "Allow attachment of persistent resources", "Effect": "Allow", "Principal": {"AWS": [ "arn:aws-cn:iam::account_id:user/KeyUser", "arn:aws-cn:iam::account_id:root" ]}, "Action": [ "kms:CreateGrant", "kms:ListGrants", "kms:RevokeGrant" ], "Resource": "*", "Condition": {"Bool": {"kms:GrantIsForAWSResource": true}} } ] }
Note

The restore-db-cluster-to-point-in-time Amazon CLI command restores only the DB cluster, not the DB instances for that DB cluster. To create DB instances for the restored DB cluster, invoke the create-db-instance command. Specify the identifier of the restored DB cluster in --db-cluster-identifier.

You can create DB instances only after the restore-db-cluster-to-point-in-time command has completed and the DB cluster is available.

To clone an Aurora cluster owned by another Amazon account
  1. Accept the invitation from the Amazon account that owns the DB cluster, as shown preceding.

  2. Clone the cluster by specifying the full ARN of the source cluster in the SourceDBClusterIdentifier parameter of the RDS API operation RestoreDBClusterToPointInTime.

    If the ARN passed as the SourceDBClusterIdentifier hasn't been shared, then the same error is returned as if the specified cluster doesn't exist.

  3. If the cluster that you are cloning is encrypted, include a KmsKeyId parameter to encrypt your cloned cluster. This kms-key-id value can be the same one used to encrypt the original DB cluster, or your own KMS key. Your account must have permission to use that encryption key.

    When you clone a volume, the destination account must have permission to use the encryption key used to encrypt the source cluster. Aurora encrypts the new cloned cluster with the encryption key specified in KmsKeyId.

    The account that owns the encryption key must grant permission to use the key to the destination account by using a key policy. This process is similar to how encrypted snapshots are shared, by using a key policy that grants permission to the destination account to use the key. An example of a key policy follows.

    { "Id": "key-policy-1", "Version": "2012-10-17", "Statement": [ { "Sid": "Allow use of the key", "Effect": "Allow", "Principal": {"AWS": [ "arn:aws-cn:iam::account_id:user/KeyUser", "arn:aws-cn:iam::account_id:root" ]}, "Action": [ "kms:CreateGrant", "kms:Encrypt", "kms:Decrypt", "kms:ReEncrypt*", "kms:GenerateDataKey*", "kms:DescribeKey" ], "Resource": "*" }, { "Sid": "Allow attachment of persistent resources", "Effect": "Allow", "Principal": {"AWS": [ "arn:aws-cn:iam::account_id:user/KeyUser", "arn:aws-cn:iam::account_id:root" ]}, "Action": [ "kms:CreateGrant", "kms:ListGrants", "kms:RevokeGrant" ], "Resource": "*", "Condition": {"Bool": {"kms:GrantIsForAWSResource": true}} } ] }
Note

The RestoreDBClusterToPointInTime RDS API operation restores only the DB cluster, not the DB instances for that DB cluster. To create DB instances for the restored DB cluster, invoke the CreateDBInstance RDS API operation. Specify the identifier of the restored DB cluster in DBClusterIdentifier. You can create DB instances only after the RestoreDBClusterToPointInTime operation has completed and the DB cluster is available.

Checking if a DB cluster is a cross-account clone

The DBClusters object identifies whether each cluster is a cross-account clone. You can see the clusters that you have permission to clone by using the include-shared option when you run the RDS CLI command describe-db-clusters. However, you can't see most of the configuration details for such clusters.

To check if a DB cluster is a cross-account clone
  • Call the RDS CLI command describe-db-clusters.

    The following example shows how actual or potential cross-account clone DB clusters appear in describe-db-clusters output. For existing clusters owned by your Amazon account, the CrossAccountClone field indicates whether the cluster is a clone of a DB cluster that is owned by another Amazon account.

    In some cases, an entry might have a different Amazon account number than yours in the DBClusterArn field. In this case, that entry represents a cluster that is owned by a different Amazon account and that you can clone. Such entries have few fields other than DBClusterArn. When creating the cloned cluster, specify the same StorageEncrypted, Engine, and EngineVersion values as in the original cluster.

    $aws rds describe-db-clusters --include-shared --region us-east-1 { "DBClusters": [ { "EarliestRestorableTime": "2023-02-01T21:17:54.106Z", "Engine": "aurora-mysql", "EngineVersion": "8.0.mysql_aurora.3.02.0", "CrossAccountClone": false, ... }, { "EarliestRestorableTime": "2023-02-09T16:01:07.398Z", "Engine": "aurora-mysql", "EngineVersion": "8.0.mysql_aurora.3.02.0", "CrossAccountClone": true, ... }, { "StorageEncrypted": false, "DBClusterArn": "arn:aws-cn:rds:us-east-1:12345678:cluster:cluster-abcdefgh", "Engine": "aurora-mysql", "EngineVersion": "8.0.mysql_aurora.3.02.0 ] }
To check if a DB cluster is a cross-account clone
  • Call the RDS API operation DescribeDBClusters.

    For existing clusters owned by your Amazon account, the CrossAccountClone field indicates whether the cluster is a clone of a DB cluster owned by another Amazon account. Entries with a different Amazon account number in the DBClusterArn field represent clusters that you can clone and that are owned by other Amazon accounts. These entries have few fields other than DBClusterArn. When creating the cloned cluster, specify the same StorageEncrypted, Engine, and EngineVersion values as in the original cluster.

    The following example shows a return value that demonstrates both actual and potential cloned clusters.

    { "DBClusters": [ { "EarliestRestorableTime": "2023-02-01T21:17:54.106Z", "Engine": "aurora-mysql", "EngineVersion": "8.0.mysql_aurora.3.02.0", "CrossAccountClone": false, ... }, { "EarliestRestorableTime": "2023-02-09T16:01:07.398Z", "Engine": "aurora-mysql", "EngineVersion": "8.0.mysql_aurora.3.02.0", "CrossAccountClone": true, ... }, { "StorageEncrypted": false, "DBClusterArn": "arn:aws-cn:rds:us-east-1:12345678:cluster:cluster-abcdefgh", "Engine": "aurora-mysql", "EngineVersion": "8.0.mysql_aurora.3.02.0" } ] }