View a markdown version of this page

Getting started with database branches - Amazon Aurora

Getting started with database branches

Working with database branches involves two audiences. Administrators and data infrastructure engineers set up access and security controls once on the parent cluster. Developers and AI coding agents then create branches, connect to them, and delete them when the work is done.

Set up access

As an administrator or data infrastructure engineer, you set up branch access on the parent cluster. Each branch inherits these settings, so you configure these controls one time on the parent.

  1. On the parent cluster, add the branching IAM actions to the roles that your developers, agents, and pipelines already use. You can scope these actions to specific clusters or tags. The branching actions are rds:CreateBranch, rds:DeleteBranch, and rds:DescribeBranches. Roles that already have full Aurora access get the branching actions automatically. For more information about how IAM works with Aurora, see Security in Amazon Aurora. For an example policy that controls branch access, see Controlling access to database branches with IAM.

  2. Define the database users and roles that developers and agents use to connect to branches. Developers and agents can connect to a branch using IAM database authentication, which lets administrators control branch access through IAM policies. For more information, see IAM database authentication .

  3. Configure Aurora dynamic data masking policies to control which data developers and agents can see in a branch. For more information, see Using dynamic masking with Aurora PostgreSQL.

Create and connect to a branch

As a developer or AI coding agent, you create a branch from the parent cluster or from another branch. You can create a branch by using the AWS Management Console, the AWS CLI, or the AWS SDKs.

Creating a branch

You can create a branch from the parent cluster or from an existing branch.

To create a branch
  1. Sign in to the AWS Management Console and open the Amazon RDS console at https://console.aws.amazon.com/rds/.

  2. Choose the AWS Region and the database cluster that you want to branch from.

  3. Choose the Branches tab, and then choose Create branch.

    The Branches tab on an Aurora cluster before any branches exist, showing a Create branch button.
  4. Review the pre-configured settings in the Create branch dialog. When you branch from the cluster, the Branch from dropdown is prepopulated with the cluster name.

    The Create branch dialog when branching from a cluster, showing the Branch from source, minimum capacity of 0 ACU, maximum capacity, and Time to live (TTL).
  5. You can also create a branch from an existing branch. When you do, Branch from is set to the branch name, and the Time to live (TTL) is capped by the source branch's remaining TTL.

    The Create branch dialog when branching from an existing branch, where the Time to live (TTL) is capped by the source branch's remaining TTL.

To create a branch by using the AWS CLI, use the create-branch command. The following AWS CLI command creates a branch from a cluster with the minimum required options.

aws rds create-branch \ --branch-name feature-auth-refactor \ --source-db-cluster-identifier my-prod-cluster

The following example creates a branch from an existing branch and sets the TTL, the scaling configuration, and tags.

aws rds create-branch \ --branch-name feature-auth-refactor \ --source-db-cluster-identifier my-prod-cluster \ --source-branch-name some-branch \ --ttl-seconds 604800 \ --scaling-configuration MaxCapacity=8,SecondsUntilAutoPause=300 \ --tags Key=team,Value=backend

To create a branch programmatically, use your preferred AWS SDK to call the CreateBranch operation. You can create a branch from a cluster or from an existing branch. This operation requires the rds:CreateBranch IAM action.

Viewing branches

You can view the branches on a cluster and their current status.

After you create branches, the Branches tab lists the active branches with their Status, Size, TTL, and Created at values.

The Branches tab listing active branches with their Status, Size, TTL, and Created at values.

Placeholder: step-by-step console instructions for viewing branches will be added here.

To list branches, use the describe-branches command. You can list all branches, describe a single branch by its Amazon Resource Name (ARN), or filter branches by source cluster or branch name.

aws rds describe-branches aws rds describe-branches \ --branch-arn arn:aws:rds:us-east-1:123456789012:branch:cluster-ABCDEFGH/br-0a1b2c3d4e5f67890 aws rds describe-branches \ --filters Name=source-db-cluster-identifier,Values=my-prod-cluster aws rds describe-branches \ --db-cluster-identifier my-prod-cluster \ --branch-name feature-auth-refactor

To list branches and view their status programmatically, use your preferred AWS SDK to call the DescribeBranches operation. This operation requires the rds:DescribeBranches IAM action.

Deleting a branch

When you finish with a branch, you can delete it. If you don't delete a branch, Aurora deletes it automatically when its TTL expires.

To delete a branch
  1. On the cluster's Branches tab, select the branch that you want to delete, and then choose Delete.

  2. In the Delete branch dialog box, to confirm the deletion, enter confirm in the text box, and then choose Delete. Deleting a branch permanently deletes the branch and its data and can't be undone; the source cluster and its other branches aren't affected.

    The Delete branch confirmation dialog, which asks you to type confirm to permanently delete the branch, and notes that the branch's data is deleted while the source cluster and other branches are not affected.

To delete a branch when you finish with it, use the delete-branch command and specify the branch ARN. In the following example, replace branch-arn with the ARN of the branch that you want to delete.

aws rds delete-branch --branch-arn <branch-arn>

To delete a branch programmatically, use your preferred AWS SDK to call the DeleteBranch operation. This operation requires the rds:DeleteBranch IAM action.

You can automate the branch lifecycle in your CI/CD pipelines. For example, a pipeline can create a branch when a pull request opens and delete the branch when the pull request closes, by using Amazon EventBridge with tools such as AWS CodePipeline and GitHub Actions.

Important

To avoid ongoing charges for branches that you no longer need, delete them with the delete-branch command, or let Aurora delete them automatically when their TTL expires.