

# Create a database cluster group for Aurora

In this step, you create a database cluster group for Aurora and check that it's available. Create the group before you add any cluster to it. You add member clusters in Step 2.

## Creating the database cluster group for Aurora
<a name="databaseclustergroups-creating"></a>

The group is a top-level Amazon RDS resource with its own Amazon Resource Name (ARN), in the form `arn:aws:rds:{{REGION}}:{{ACCOUNT}}:cluster-group:{{RESOURCE_ID}}`. An IAM policy names a group the way that it names a cluster. The group has automated backups from the time that you create it, and you can't turn them off. The shortest retention period for a group is one day.

Routing is a setting on the group. You can enable routing when you create the group, with `--enable-routing` on `create-db-cluster-group`. You can also enable it later with `modify-db-cluster-group --enable-routing`, as [Enable routing and add data mappings](databaseclustergroups-gs-routing.md) describes.
+ **Without routing,** the group has no routing layer or routing endpoint. Applications keep connecting to each member cluster directly.
+ **With routing,** the group creates the routing layer (managed by AWS), one routing endpoint, and the first administrative router user, which holds the `dbclustergroup_super_admin` privilege. You can then use data mappings and data movement with minimal downtime.

Applications keep connecting directly until you point them at the routing endpoint.

To create the group, call `CreateDBClusterGroup` (`aws rds create-db-cluster-group`). The engine value is `aurora-mysql` for Aurora MySQL. The routing endpoint listens on port 3306. You can't change the port. `describe-db-cluster-groups` returns it in `RoutingEndpointConfigurationInfo.Port`.

------
#### [ Console ]

**To create a group and enroll your clusters (console)**

1. Sign in to the AWS Management Console and open the Amazon RDS console at [https://console.aws.amazon.com/rds/](https://console.aws.amazon.com/rds/).

1. In the navigation pane, choose **Database cluster groups**, and then choose **Create cluster group**.

1. Enter the **Cluster group identifier**, choose the **Engine**, choose **Add existing clusters**, and add your clusters.  
![The Create cluster group page with an identifier entered, Engine set to Aurora MySQL, and Add existing clusters selected.](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/images/dbcg-console-create-group.png)  
   The Cluster group settings and Cluster type sections of the Create cluster group page.

1. Choose **Next**, set the group settings, and choose **Create cluster group**. To enable routing now, select **Enable routing** in the group settings. For each field, see [Creating a database cluster group for Aurora](databaseclustergroups-group-lifecycle.md#databaseclustergroups-group-lifecycle-create).

1. Choose the group, and on the **Member clusters** tab, verify that every cluster appears.

The clusters that you add here join the group in place. For what changes when a cluster joins, see [Adding clusters that you already run](databaseclustergroups-gs-add-members.md#databaseclustergroups-gs-add-existing). If you add every cluster in this step, skip the add procedure in Step 2.

------
#### [ AWS CLI ]

**To create a database cluster group for Aurora (AWS CLI)**

1. To enable routing at create time, put the administrator password in a JSON file that only you can read (mode 600). For example, create `group-admin-password.json` with the content `{"AdminUserPassword": "{{PASSWORD}}"}`.

1. With the AWS CLI, run the following command. For {{ENGINE}}, use `aurora-mysql`.

   ```bash
   aws rds create-db-cluster-group --region {{REGION}} \
       --db-cluster-group-identifier {{GROUP_IDENTIFIER}} \
       --engine {{ENGINE}} \
       --enable-routing \
       --admin-username {{ADMIN_USER}} \
       --routing-endpoint-configuration '{"VpcSubnetIds":["{{SUBNET_1}}","{{SUBNET_2}}"],"VpcSecurityGroupIds":["{{SECURITY_GROUP}}"],"NetworkType":"IPV4"}' \
       --backup-retention-period {{DAYS}} \
       --preferred-backup-window {{HH:MM-HH:MM}} \
       --preferred-maintenance-window {{ddd:HH:MM-ddd:HH:MM}} \
       --cli-input-json file://group-admin-password.json
   ```

   When you enable routing, specify `VpcSubnetIds`. Give subnets in at least two Availability Zones of one VPC. If you leave out `VpcSecurityGroupIds` or `NetworkType`, the routing endpoint uses the default security group of the VPC and `IPV4`. The routing endpoint always listens on port 3306, and you can't change it. While routing is on, you can't change the subnets, the security groups, or the network type, so choose them before you run the command. For these settings, see [Network access](databaseclustergroups-network.md).

   To create the group without routing, leave out `--enable-routing`, `--admin-username`, `--routing-endpoint-configuration`, and `--cli-input-json`. If you pass `--routing-endpoint-configuration` without `--enable-routing`, the call fails with an `InvalidParameterCombination` error.

1. Delete the password file.

------
#### [ Amazon RDS API ]

Call `CreateDBClusterGroup` with `DBClusterGroupIdentifier` and `Engine`. To enable routing, also set `EnableRouting` to `true`, and set `AdminUsername`, `AdminUserPassword`, and `RoutingEndpointConfiguration` with at least `VpcSubnetIds`.

------

When you enable routing, the administrative router user name and password are required, and the call refuses them without routing. For the network parameters for routing, see [Routing endpoint networking](databaseclustergroups-network.md#databaseclustergroups-network-routing-endpoint).

Then check the group.

------
#### [ AWS CLI ]

**To check the database cluster group for Aurora (AWS CLI)**

1. With the AWS CLI, call `DescribeDBClusterGroups` (`aws rds describe-db-cluster-groups`). Repeat until `Status` reads `available`.

   ```bash
   aws rds describe-db-cluster-groups --region {{REGION}} \
       --db-cluster-group-identifier {{GROUP_IDENTIFIER}} \
       --query 'DBClusterGroups[0].{Status:Status,RoutingEnabled:RoutingEnabled,Routing:RoutingEndpointConfigurationInfo}'
   ```

1. If you enabled routing, record the routing endpoint from `RoutingEndpointConfigurationInfo.Endpoint` in the same output. Use the name that the description returns, and don't compose it yourself.

------
#### [ Amazon RDS API ]

Call `DescribeDBClusterGroups` with `DBClusterGroupIdentifier`. Repeat until `Status` reads `available`. If you enabled routing, read the routing endpoint from `RoutingEndpointConfigurationInfo`.

------

**Result:** The group is `available`. If you enabled routing, `RoutingEnabled` is `true` and the description lists the routing endpoint. For every create option, see [Creating, modifying, and deleting a database cluster group for Aurora](databaseclustergroups-group-lifecycle.md).

Next, add member clusters to the group, in [Add member clusters](databaseclustergroups-gs-add-members.md).