

# Prerequisites for using Aurora data groups

You can use data groups on a new or an existing DB cluster. The DB cluster must meet the requirements in [Requirements for Aurora data groups](aurora-data-groups-reqs-limits.md#dg-requirements), such as a supported engine version and Aurora I/O-Optimized storage. To create a DB cluster, see [Creating an Amazon Aurora DB cluster](Aurora.CreateInstance.md). To move a data group, you need a second DB cluster that meets the same requirements.

You also need IAM permissions for data group operations. If you plan to move data groups, you also need a cluster admin user with the same name on both DB clusters, mapped to each data group.

**Topics**
+ [Setting up IAM permissions for data groups](#dg-prereq-iam)
+ [Mapping the cluster admin user](#dg-prereq-admin)

## Setting up IAM permissions for data groups
<a name="dg-prereq-iam"></a>

You need permissions to perform operations on data groups. You can create AWS Identity and Access Management (IAM) policies that grant users and roles permission to perform specific API operations on the resources that they need. You can then attach those policies to the IAM permission sets or roles that require those permissions. For more information, see [Identity and access management for Amazon Aurora](UsingWithRDS.IAM.md).

The permissions that you need depend on the data group operation that you perform:
+ To create, view, modify, and delete data groups, grant `rds:CreateDataGroup`, `rds:DescribeDataGroups`, `rds:ModifyDataGroup`, and `rds:DeleteDataGroup` on the DB cluster that contains the data groups.
+ To move a data group, grant `rds:MoveDataGroup` on both the source and the target DB clusters.
+ To find the restore window for a data group, grant `rds:DescribeDataGroupRestoreWindows` on the DB cluster. If you specify an automated backup, also grant it on that automated backup.
+ To find the data groups in a snapshot, grant `rds:DescribeDBClusterSnapshotDataGroups` on the DB cluster snapshot.
+ To add tags to a data group, grant `rds:AddTagsToResource` on `data-group:*` and `rds:AddTagsToDataGroup` on `*`.
+ To add tags when you create a data group, grant `rds:AddTagsToResource` and `rds:AddTagsToDataGroup` on `*`.
+ To remove tags from a data group, grant `rds:RemoveTagsFromResource` on `data-group:*` and `rds:RemoveTagsFromDataGroup` on `*`.
+ To restore a DB cluster with data groups, grant `rds:RestoreDBClusterFromSnapshot` or `rds:RestoreDBClusterToPointInTime`, as for any DB cluster restore.

`rds:AddTagsToDataGroup` and `rds:RemoveTagsFromDataGroup` apply only to data groups. To control who can tag data groups, allow or deny these permissions.

You also need permissions on the AWS KMS key that the data group uses. For more information, see [How data groups use KMS keys](aurora-data-groups-encrypting.md#dg-encrypt-keys).

**Note**  
Because you can't specify an individual data group in a policy, you can't scope a policy to one data group. Anyone who can act on the DB cluster can act on every data group in it.

## Mapping the cluster admin user
<a name="dg-prereq-admin"></a>

To move a data group, map the cluster admin user to it as `EXPECT_NAME_MATCH`. Aurora refuses a move without this mapping, even when you run the move as the cluster admin user. The cluster admin user owns the databases that it creates, so almost every data group needs this mapping.

Before you move a data group, make sure that the following conditions are met:
+ The source and target DB clusters have a cluster admin user with the same name, such as `postgres`. You choose the name when you create the DB cluster, and you can't change it later.
+ The cluster admin user is mapped to each data group that you want to move. Map it right after you create the data group.

The following SQL maps the cluster admin user `postgres` to the `tenant42` data group. Run it on the writer DB instance of the source DB cluster.

```SQL
SELECT * FROM aurora_datagroup_add_role_access('tenant42', 'EXPECT_NAME_MATCH', '{{postgres}}');
```

If you don't plan to move a data group, you don't need to map any roles. For the full rules, see [Managing roles for data groups](aurora-data-groups-users.md).