

# Overview of Aurora data groups

A data group is a container for one or more databases. You can create a database in a data group, or migrate an existing database into one. A DB cluster can have several data groups. Databases that you don't create in or migrate into a data group stay in the default data group.

Data groups give you four capabilities for each data group:

Encrypt  
Encrypt each data group with its own KMS key. For example, you can let the owner of the data control the key of its data group, so that the owner can revoke the key to lock access to the data group. For more information, see [Encrypting data groups in Amazon Aurora](aurora-data-groups-encrypting.md).

Monitor  
Monitor each data group's load on the DB cluster, such as its connections, transactions, and I/O. Use it to find the data groups that need more capacity, and to decide which data group to move. For more information, see [Monitoring data groups](aurora-data-groups-monitoring.md).

Move  
Move a data group to another DB cluster in the same AWS account and AWS Region. The data stays in place in the distributed Aurora storage, and only metadata changes. The data group's databases are unavailable for typically **single-digit seconds**, and the source and target DB clusters keep serving their other databases without downtime. For example, move a busy data group to a less loaded DB cluster or to a DB cluster of its own, or combine data groups from several DB clusters onto fewer DB clusters to reduce cost. For more information, see [Moving a data group to another DB cluster](aurora-data-groups-moving.md).

Restore  
When you restore a DB cluster from a backup, you can restore one data group, several, or all of them. For example, recover one data group after a mistake corrupted its data, without restoring the other data groups. Your restored DB cluster also includes the default data group, in addition to any data groups that you select. For more information, see [Backing up and restoring DB clusters with data groups](aurora-data-groups-backup.md).

For more information on the architecture of a standard Aurora DB cluster, see [Amazon Aurora DB clusters](Aurora.Overview.md).

## Key terms for Aurora data groups
<a name="dg-terms"></a>

**Data group**  
A container for databases in an Aurora DB cluster that you can move to another DB cluster.  
On Aurora PostgreSQL, each data group has a tablespace with the same name, which Aurora creates when you create the data group. A database that you create in that tablespace is in the data group. To create a database in the data group, name the tablespace in the `CREATE DATABASE` statement. For more information, see [Creating a database in a data group](aurora-data-groups-using.md#dg-create-databases).

**Default data group**  
The part of a DB cluster that holds every database that isn't in a data group that you created. Each DB cluster that supports data groups has a default data group.  
The default data group holds the `postgres`, `rdsadmin`, `template0`, and `template1` databases, and every database that you create without naming a data group.  
The default data group shows only in the engine's SQL views, not in the Amazon RDS API or the console. On Aurora PostgreSQL, it shows as `pg_default`.

**Data group identifier**  
The unique ID that Aurora assigns when you create a data group, such as `dg-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111`. Amazon RDS API operations and AWS CLI commands after `create-data-group` take this identifier or the data group ARN. SQL functions in the database, such as the role mapping functions, take the data group name.

**Data group domain**  
A property of a DB cluster that Aurora assigns when it creates the DB cluster volume. You can move a data group only between DB clusters that have the same data group domain. Aurora moves it by updating only metadata. For more information about data group domains, see [Data group domains](#dg-domains).

**Data group endpoint**  
A writer endpoint and a reader endpoint for one data group. Both follow the data group when it moves to another DB cluster, so applications keep the same host name after a move. For more information, see [Data group endpoints](aurora-data-groups-endpoints.md).

**Source DB cluster**  
The DB cluster that holds the data group when a move starts.

**Target DB cluster**  
The DB cluster that you're moving the data group to.

**Move**  
A move hands a data group from the source DB cluster to the target DB cluster. A move has two steps, prepare move and execute move, and you start each step separately. For more information, see [How a data group move works](aurora-data-groups-moving.md#dg-how-moves-work).

**Prepare move**  
The first step of a move. The target DB cluster checks that it can take the data group and imports what the data group needs, such as roles. Applications keep reading and writing, but schema changes (DDL) are refused.

**Execute move**  
The second and last step of a move. The source DB cluster stops writes to the data group and passes its storage to the target DB cluster. It also ends open sessions in the data group's databases, so reads of those databases stop too.

**Cancel move**  
Stopping a move before the execute step starts. The data group stays on the source DB cluster with its data unchanged.

**Role mapping**  
Metadata that links a database role or user to a data group. A move uses the mapping to decide whether to create the role on the target DB cluster or to use an existing role with the same name there. For more information, see [Managing roles for data groups](aurora-data-groups-users.md).

**Data group migration**  
An online copy of an existing database from one data group to another in the same DB cluster. You use it to bring existing data into a data group. For more information, see [Migrating existing databases into a data group](aurora-data-groups-migrating.md).

You can see the status of a data group with the Amazon RDS API, or with SQL views when you connect to the DB cluster.

## Planning your data groups
<a name="dg-planning"></a>

Some of these choices can't be changed later, so decide the following before you create your first data group:
+ What goes in each data group – A data group is encrypted, monitored, moved, and restored as a whole. Keep the databases that you plan to move, encrypt, or restore together in the same data group. For example, a data group can hold an application's `orders` and `billing` databases. By default, a DB cluster can have up to 100 data groups. To request a higher limit for your use case, contact AWS Support.
+ Names – Choose a name that stays unique on every DB cluster that the data group might move to, such as `tenant42`, because you can't change a data group's name after you create it. A move needs the name to be free on the target DB cluster, and a DB cluster can't hold two data groups with the same name. For the naming rules, see [Considerations for Aurora data groups](aurora-data-groups-reqs-limits.md#dg-considerations).
+ Roles – Give each data group its own application role and map it as `DATAGROUP_CONSTRAINED`, so that it moves with the data group. Create the data group's schemas and other objects with that role. Create shared roles, such as a reporting role, with the same name and settings on every DB cluster that can receive a data group. For more information, see [Managing roles for data groups](aurora-data-groups-users.md).
+ Connection routing – After a move, the DB cluster endpoints of the source DB cluster no longer reach the data group. If your applications connect through DB cluster endpoints, keep a record of which DB cluster holds each data group, for example in a configuration table or your connection proxy, and update it after each move. Or connect through a data group endpoint, which follows the data group to the target DB cluster. For more information, see [Data group endpoints](aurora-data-groups-endpoints.md).
+ Target DB clusters – Keep the DB clusters that exchange data groups alike: the same engine version, the same data group domain, the same `shared_preload_libraries`, and the same extension versions. Leave room in the target volume. For the full list, see [Before you move a data group](aurora-data-groups-moving.md#dg-move-before).
+ Encryption – Decide when you create the data group whether the data group needs its own KMS key. You can't change the key later. For more information, see [Encrypting data groups in Amazon Aurora](aurora-data-groups-encrypting.md).

## Data group domains
<a name="dg-domains"></a>

A *data group domain* is a property of a DB cluster that Aurora assigns when it creates the DB cluster volume. Every DB cluster has a data group domain, including DB clusters that you created before data groups were available. Aurora can move a data group between two DB clusters that have the same data group domain by updating only metadata, without copying the data.

DB clusters that have the same data group domain store their cluster volumes in the same Availability Zones. DB clusters whose cluster volumes are in the same Availability Zones don't necessarily have the same data group domain.

Each data group domain has an identifier, such as `dg-domain-021345abcdef6789`. The identifier is unique in your AWS account and AWS Region, and doesn't name the Availability Zones that the data group domain uses.

At preview, there is one data group domain, so every DB cluster that supports data groups has the same data group domain.

To see the data group domain of a DB cluster, use the AWS CLI [describe-db-clusters](https://docs.aws.amazon.com/cli/latest/reference/rds/describe-db-clusters.html) command or the Amazon RDS API [DescribeDBClusters](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DescribeDBClusters.html) operation. The `DataGroupDomainIdentifier` field shows the data group domain identifier. In the following example, replace `{{orders-cluster-1}}` with the identifier of your DB cluster.

```
aws rds describe-db-clusters \
    --db-cluster-identifier {{orders-cluster-1}} \
    --query "DBClusters[0].DataGroupDomainIdentifier"
```

The output resembles the following example.

```
"dg-domain-021345abcdef6789"
```

## Billing for Aurora data groups
<a name="dg-billing"></a>

At preview, you pay standard Aurora pricing for the DB clusters that you use with data groups. At preview, data groups require Aurora I/O-Optimized storage, which is priced differently from Aurora Standard storage. For information on how you're charged for Aurora, see [ DB instance billing for Aurora](User_DBInstanceBilling.md).

For Aurora pricing information, see the [Aurora pricing page](https://aws.amazon.com/rds/aurora/pricing).