Database changes are an important part of application development. Developers regularly add tables, modify columns, create indexes, update stored procedures, and run database migrations. These changes must be tested carefully before they reach production.
A common approach is to maintain a separate development or staging database. However, keeping these environments synchronized with production data can be difficult. Creating a complete copy of a large database can also take time and require additional storage.
Amazon Aurora introduces database branching to make this process easier.
Database branching allows developers to create isolated, writable branches of an Aurora PostgreSQL database. Each branch has its own endpoint and compute resources, while initially sharing the source database's storage through a copy-on-write mechanism.
This makes it possible to test schema changes, database migrations, and application code against production-derived data without modifying the original database.
Database branching is particularly useful for development teams, CI/CD pipelines, and AI coding agents that need separate database environments for different tasks.
In this article, we will understand how Aurora database branching works, create branches using the AWS CLI, connect to a branch using PostgreSQL tools, manage branch permissions, and integrate database branches into an automated testing workflow.
1. What Is Amazon Aurora Database Branching?
Amazon Aurora database branching is a capability that creates an isolated, writable version of an existing Aurora PostgreSQL database.
You can think of a database branch as a separate working environment created from a source database.
For example, suppose your production application uses an Aurora PostgreSQL cluster named production-db.
Three developers are working on different features:
Developer A is modifying the customer table.
Developer B is testing a new order-processing migration.
Developer C is improving database indexes.
If all three developers use the same staging database, their changes can interfere with one another.
With database branching, each developer can work on a separate branch.
Production Aurora Cluster
|
+--------------+--------------+
| | |
v v v
Branch A Branch B Branch C
| | |
Customer Order Schema Index
Changes Migration Testing
| | |
v v v
Developer A Developer B Developer CEach branch has an independent database state. Changes made in one branch do not modify the source database or another branch.
This is useful when several developers or automated agents need to test different database changes simultaneously.
Important Availability Note
As of December 4, 2026, Amazon Aurora database branching is in preview.
The preview supports Aurora PostgreSQL version 17 and higher in these AWS Regions:
US East (Ohio).
Europe (Frankfurt).
Asia Pacific (Mumbai).
It is not a general-purpose production database feature at this stage. AWS explicitly recommends against using database branches for production workloads during the preview.
Check the current AWS documentation before creating branches because preview behavior, availability, and limits can change.
2. How Database Branching Works
Aurora database branching combines two important technologies:
Copy-on-write storage.
Isolated serverless compute.
Understanding these concepts explains why branches can be created without physically copying the entire database.
Copy-on-Write Storage
Copy-on-write is a storage technique in which multiple database environments initially share existing data pages.
When a branch is created, Aurora does not immediately duplicate every database page.
Instead, the new branch references the source data.
When a developer changes data inside the branch, Aurora stores the modified pages separately.
Consider the following example:
Original Database
-----------------
Page A
Page B
Page C
Page D
New Branch
-----------------
Page A Shared
Page B Shared
Page C Shared
Page D SharedNow suppose a developer updates records stored in Page B.
The branch receives its own modified version of that page.
Original Database
-----------------
Page A
Page B
Page C
Page D
New Branch
-----------------
Page A Shared
Page B Modified Copy
Page C Shared
Page D SharedThe original database remains unchanged.
This is why creating a branch is generally faster and more storage-efficient than physically copying the entire database.
The actual storage consumed by a branch depends on how much data changes after branching.
Isolated Serverless Compute
Every database branch has its own Aurora Serverless compute.
This means that queries executed on one branch do not use the compute resources of another branch.
For example, Developer A can run a migration on Branch A while Developer B executes integration tests on Branch B.
Each branch has its own compute capacity configuration.
Branches can also scale to zero when idle, reducing compute consumption when nobody is using them.
You do not select a provisioned DB instance type for a branch. Aurora manages its serverless compute.
Dedicated Database Endpoint
Every branch has its own read/write endpoint.
Applications and database tools connect to the branch using this endpoint.
For example:
Production Endpoint:
production-db.cluster-xyz.ap-south-1.rds.amazonaws.com
Branch A Endpoint:
branch-a.cluster-xyz.ap-south-1.rds.amazonaws.com
Branch B Endpoint:
branch-b.cluster-xyz.ap-south-1.rds.amazonaws.comThese are illustrative endpoint formats, not actual AWS endpoints.
The important point is that each branch has a separate connection endpoint.
Your application can connect to a branch just as it connects to an ordinary Aurora PostgreSQL database.
3. Database Branching Architecture
The following architecture illustrates how developers, CI/CD pipelines, and AI agents can use database branches.
Git Repository
|
v
Pull Request
|
v
CI/CD Pipeline
|
v
AWS RDS CreateBranch
|
v
Production Aurora Cluster
|
+--------+--------+
| | |
v v v
Branch A Branch B Branch C
| | |
v v v
Tests Migration AI Agent
| | |
+--------+--------+
|
v
Test Results
|
+--------+--------+
| |
v v
Success Failure
| |
v v
Apply Migration Delete Branch
Through Normal
Deployment ProcessThis architecture separates database testing from production database operations.
A branch can be created when a pull request is opened. The pipeline can then apply the proposed migration, execute tests, and delete the branch when the work is finished.
One important detail is that database branching does not merge changes back into the production database.
If a migration succeeds in a branch, your normal deployment process must still apply that migration to production.
4. Prerequisites
Before creating database branches, prepare the following:
Requirement | Purpose |
|---|---|
AWS account | Access Aurora and database branching |
Aurora PostgreSQL 17 or later | Source database for branching |
Supported AWS Region | Use a region where preview is available |
AWS CLI | Create, list, and delete branches |
IAM permissions | Control branch operations |
PostgreSQL client | Connect to a branch |
Source Aurora cluster | Database from which branches are created |
For this example, assume the following configuration:
AWS Region: ap-south-1
Source Cluster: production-db
Branch Name: feature-order-migration
Database: postgres
Port: 5432Replace these values with your actual environment configuration.
Make sure the source cluster is running a supported Aurora PostgreSQL version and is in a compatible state.
5. Configure IAM Permissions
Database branching operations are managed through Amazon RDS APIs.
Developers and CI/CD pipelines need the appropriate IAM permissions to create, inspect, and delete branches.
The primary actions are:
IAM action | Purpose |
|---|---|
rds:CreateBranch | Create a database branch |
rds:DescribeBranches | View branch information |
rds:DeleteBranch | Delete a branch |
An administrator can create a dedicated IAM policy for a development team.
For example:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"rds:CreateBranch",
"rds:DescribeBranches",
"rds:DeleteBranch"
],
"Resource": "*"
}
]
}This is a simplified example.
For production AWS accounts, restrict permissions to the intended Aurora resources and use resource tags or other supported IAM conditions where appropriate.
Avoid granting unrestricted access to every database cluster.
Why Separate Branch Permissions?
Not every developer should be allowed to create branches from every production database.
For example:
A development team may access branches created from its application database.
A CI/CD role may create and delete branches for pull requests.
A database administrator may manage branch access and configuration.
An AI coding agent may receive access only to a specific branch.
This approach reduces the risk of accidental access to unrelated database environments.
6. Create Your First Aurora Database Branch
You can create a database branch using the AWS Management Console, AWS CLI, or AWS SDK.
The AWS CLI is useful for automation because it can be integrated into development scripts and CI/CD pipelines.
Use the following command:
aws rds create-branch \
--source-db-cluster-identifier production-db \
--branch-name feature-order-migration \
--ttl-seconds 86400 \
--scaling-configuration MaxCapacity=16 \
--region ap-south-1Let's understand the parameters.
source-db-cluster-identifier
This identifies the Aurora PostgreSQL cluster from which the branch will be created.
In this example, the source cluster is production-db.
branch-name
This is the name assigned to the new branch.
Use meaningful names that identify the developer, feature, or pull request.
Examples:
feature-order-migration
pr-125-customer-schema
agent-payment-validation
developer-auth-testingttl-seconds
TTL stands for Time to Live.
It defines how long the branch should exist before Aurora automatically deletes it.
The example uses:
86400 seconds = 24 hoursA branch must have a TTL between one hour and 90 days during the current preview.
scaling-configuration
This defines the serverless compute scaling configuration.
The example specifies a maximum capacity of 16 Aurora Capacity Units (ACUs).
Aurora manages the branch compute and can scale it according to workload requirements.
The exact available capacity range depends on the account and preview limits.
Verify Branch Creation
The create-branch command returns information about the new branch.
A newly created branch initially has a creating status.
Do not assume that it is ready for database connections immediately.
Check its status using:
aws rds describe-branches \
--db-cluster-identifier production-db \
--branch-name feature-order-migration \
--region ap-south-1Review the returned status and endpoint.
Wait until the branch is available before connecting your application or running migrations.
7. List All Database Branches
When multiple developers are working on the same database, administrators need a way to inspect active branches.
Use:
aws rds describe-branches \
--db-cluster-identifier production-db \
--region ap-south-1The response provides branch information, including identifiers, status, endpoints, and expiration details.
This is useful for:
Checking whether a branch is ready.
Finding branches created by CI/CD.
Monitoring branch expiration.
Identifying unused development environments.
Troubleshooting failed branch creation.
For a larger team, branch information can be collected by an automation process and displayed in an internal development dashboard.
8. Connect to an Aurora Database Branch
After the branch becomes available, connect to its endpoint using a PostgreSQL client.
You can use psql, pgAdmin, DBeaver, or an application built with a PostgreSQL driver.
First, retrieve the branch endpoint using describe-branches.
For example:
branch-a.example.ap-south-1.rds.amazonaws.comThe actual endpoint is returned by AWS.
Connect Using Password Authentication
If your database user has password-based authentication configured, connect using:
psql \
--host=BRANCH_ENDPOINT \
--port=5432 \
--username=app_dev \
--dbname=postgres \
--set=sslmode=requireReplace BRANCH_ENDPOINT with the endpoint returned by AWS.
You will be prompted for the database password.
Connect Using IAM Database Authentication
Aurora also supports IAM database authentication.
This allows authorized IAM identities to generate temporary authentication tokens instead of storing a long-lived database password in application configuration.
Generate a token:
TOKEN=$(aws rds generate-db-auth-token \
--hostname BRANCH_ENDPOINT \
--port 5432 \
--region ap-south-1 \
--username app_dev)Connect using psql:
PGPASSWORD="$TOKEN" psql \
"host=BRANCH_ENDPOINT \
port=5432 \
user=app_dev \
dbname=postgres \
sslmode=require"Replace the example values with your branch endpoint and database user.
The database user must be configured for IAM database authentication, and the IAM identity must have the required database-connect authorization.
The token is temporary. Generate a fresh token when establishing a new connection rather than treating it as a permanent password.
Also, make sure the branch inherits the expected connectivity configuration, including VPC and security group settings.
9. Test Database Schema Changes in a Branch
Now that the branch is available, you can safely test schema changes.
Suppose your application has an existing orders table:
CREATE TABLE orders (
order_id BIGINT PRIMARY KEY,
customer_id BIGINT NOT NULL,
order_amount NUMERIC(12, 2),
created_at TIMESTAMP
);Your development team wants to add a payment_status column.

Join the conversation! Your thoughts help the community grow.