Amazon Aurora
User Guide for Aurora (API Version 2014-10-31)

Creating an Amazon Aurora DB Cluster

An Amazon Aurora DB cluster consists of a DB instance, compatible with either MySQL or PostgreSQL, and a cluster volume that represents the data for the DB cluster, copied across three Availability Zones as a single, virtual volume. The DB cluster contains a primary instance and, optionally, up to 15 Aurora Replicas. For more information about Aurora DB clusters, see Amazon Aurora DB Clusters.

The following topic shows how to create an Aurora DB cluster and then add an Aurora Replica for that DB cluster.

Important

You must complete the tasks in the Setting Up Your Environment for Amazon Aurora section before you can create an Aurora DB cluster.

This topic describes how you can create an Aurora DB cluster using either the AWS Management Console or the AWS CLI. For simple instructions on connecting to your Aurora DB cluster, see Connecting to an Amazon Aurora DB Cluster.

DB Cluster Prerequisites

The following are prerequisites to create a DB cluster.

VPC

You can only create an Amazon Aurora DB cluster in a virtual private cloud (VPC), in an AWS Region that has at least two Availability Zones. The DB subnet group that you choose for the DB cluster must cover at least two Availability Zones. This configuration ensures that your DB cluster always has at least one DB instance available for failover, in the unlikely event of an Availability Zone failure.

If you are using the AWS Management Console to create your Aurora DB cluster, then you can have Amazon RDS automatically create a VPC for you. Alternatively, you can use an existing VPC or create a new VPC for your Aurora DB cluster. Your VPC must have at least one subnet in each of at least two Availability Zones in order for you to use it with an Amazon Aurora DB cluster. For more information, see How to Create a VPC for Use with Amazon Aurora. For information on VPCs, see Amazon Virtual Private Cloud (VPCs) and Amazon RDS.

Note

You can communicate with an EC2 instance that is not in a VPC and an Amazon Aurora DB cluster using ClassicLink. For more information, see A DB Instance in a VPC Accessed by an EC2 Instance Not in a VPC.

If you don't have a default VPC or you have not created a VPC, you can have Amazon RDS automatically create a VPC for you when you create an Aurora DB cluster using the AWS Management Console. Otherwise, you must do the following:

Additional Prerequisites

  • If you are connecting to AWS using IAM credentials, your IAM account must have IAM policies that grant the permissions required to perform Amazon RDS operations. For more information, see Authentication and Access Control.

    If you are using an IAM account to access the Amazon RDS console, you must first log on to the AWS Management Console with your IAM account, and then go to the Amazon RDS console at https://console.aws.amazon.com/rds/.

  • If you want to tailor the configuration parameters for your DB cluster, you must specify a DB cluster parameter group and DB parameter group with the required parameter settings. For information about creating or modifying a DB cluster parameter group or DB parameter group, see Working with DB Parameter Groups and DB Cluster Parameter Groups.

  • You must determine the TCP/IP port number you will specify for your DB cluster. The firewalls at some companies block connections to the default ports (3306 for MySQL, 5432 for PostgreSQL) for Aurora. If your company firewall blocks the default port, choose another port for your DB cluster. All instances in a DB cluster use the same port.

Creating a DB Cluster

You can create an Aurora DB cluster using the AWS Management Console, the AWS CLI, or the RDS API.

Console

To create an Aurora DB cluster using the AWS Management Console

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

  2. In the top-right corner of the AWS Management Console, select the AWS Region in which you want to create the Aurora DB cluster.

  3. In the navigation pane, choose Instances.

    If the navigation pane is closed, choose the menu icon at the top left to open it.

  4. Choose Create database to open the Select engine page.

  5. On the Select engine page, choose MySQL 5.6-compatible, MySQL 5.7-compatible, or PostgreSQL-compatible edition of Aurora.

    
                            Amazon Aurora Select engine
  6. Choose Next.

  7. On the Specify DB details page, specify your DB instance information. The following table shows settings for a DB instance.

    For This Option Do This

    Capacity type

    Choose Provisioned to manage the capacity for your DB instance manually. You might need to change the DB instance class for your instance if your workload changes.

    Choose Serverless for Aurora to manage the capacity available to your DB instance automatically. For more information, see Using Amazon Aurora Serverless.

    DB engine version

    Applies only to the provisioned capacity type. Choose the version number of your DB engine.

    DB instance class

    Applies only to the provisioned capacity type. Choose a DB instance class that defines the processing and memory requirements for each instance in the DB cluster. For more information about DB instance classes, see Choosing the DB Instance Class.

    Multi-AZ deployment

    Applies only to the provisioned capacity type. Determine if you want to create Aurora Replicas in other Availability Zones for failover support. If you choose Create Replica in Different Zone, then Amazon RDS creates an Aurora Replica for you in your DB cluster in a different Availability Zone than the primary instance for your DB cluster. For more information about multiple Availability Zones, see Choosing the Regions and Availability Zones.

    DB instance identifier

    Enter a name for the primary instance in your DB cluster. This identifier is used in the endpoint address for the primary instance of your DB cluster.

    The DB instance identifier has the following constraints:

    • It must contain from 1 to 63 alphanumeric characters or hyphens.

    • Its first character must be a letter.

    • It can't end with a hyphen or contain two consecutive hyphens.

    • It must be unique for all DB instances per AWS account, per AWS Region.

    Master username

    Enter a name using alphanumeric characters to use as the master user name to log on to your DB cluster.

    Master password

    Enter a password that contains from 8 to 41 printable ASCII characters (excluding /,", and @) for your master user password.

    A typical Specify DB details page looks like the following.

    
                            Amazon Aurora Details
  8. Confirm your master password and choose Next.

  9. On the Configure advanced settings page, you can customize additional settings for your Aurora DB cluster. The following table shows the advanced settings for a DB cluster.

    For This Option... Do This

    Virtual Private Cloud (VPC)

    Select the VPC that will host the DB cluster. Select Create a New VPC to have Amazon RDS create a VPC for you. For more information, see DB Cluster Prerequisites earlier in this topic.

    Subnet group

    Select the DB subnet group to use for the DB cluster. For more information, see DB Cluster Prerequisites earlier in this topic.

    Public accessibility

    Select Yes to give the DB cluster a public IP address; otherwise, select No. The instances in your DB cluster can be a mix of both public and private DB instances. For more information about hiding instances from public access, see Hiding a DB Instance in a VPC from the Internet.

    Availability zone

    Determine if you want to specify a particular Availability Zone. For more information about Availability Zones, see Choosing the Regions and Availability Zones.

    VPC security groups

    Select Create new VPC security group to have Amazon RDS create a VPC security group for you. Or, select Select existing VPC security groups and specify one or more VPC security groups to secure network access to the DB cluster. For more information, see DB Cluster Prerequisites earlier in this topic.

    DB Cluster Identifier

    Type a name for your DB cluster that is unique for your account in the AWS Region you selected. This identifier will be used in the cluster endpoint address for your DB cluster. For information on the cluster endpoint, see Amazon Aurora Connection Management.

    The DB cluster identifier has the following constraints:

    • It must contain from 1 to 63 alphanumeric characters or hyphens.

    • Its first character must be a letter.

    • It cannot end with a hyphen or contain two consecutive hyphens.

    • It must be unique for all DB clusters per AWS account, per AWS Region.

    Database name

    Type a name for your default database of up to 64 alpha-numeric characters. If you don't provide a name, Amazon RDS will not create a database on the DB cluster you are creating.

    To create additional databases, connect to the DB cluster and use the SQL command CREATE DATABASE. For more information about connecting to the DB cluster, see Connecting to an Amazon Aurora DB Cluster.

    Database port

    Specify the port that applications and utilities will use to access the database. Aurora MySQL DB clusters default to the default MySQL port, 3306, and Aurora PostgreSQL DB clusters default to the default PostgreSQL port, 5432. The firewalls at some companies block connections to these default ports. If your company firewall blocks the default port, choose another port for the new DB cluster.

    DB parameter group

    Select a parameter group. Aurora has a default parameter group you can use, or you can create your own parameter group. For more information about parameter groups, see Working with DB Parameter Groups and DB Cluster Parameter Groups.

    DB cluster parameter group

    Select a DB cluster parameter group. Aurora has a default DB cluster parameter group you can use, or you can create your own DB cluster parameter group. For more information about DB cluster parameter groups, see Working with DB Parameter Groups and DB Cluster Parameter Groups.

    Option group

    Aurora has a default option group.

    Copy tags to snapshots

    Applies only to Aurora PostgreSQL. Select to specify that tags defined for this DB instance are copied to DB snapshots created from this DB instance. For more information, see Tagging Amazon RDS Resources.

    IAM DB authentication

    Applies only to Aurora MySQL. Select Enable IAM DB authentication to enable IAM database authentication. For more information, see IAM Database Authentication.

    Encryption

    Select Enable encryption to enable encryption at rest for this DB cluster. For more information, see Encrypting Amazon RDS Resources.

    Master key

    Only available if Encryption is set to Enable encryption. Select the master key to use for encrypting this DB cluster. For more information, see Encrypting Amazon RDS Resources.

    Priority

    Choose a failover priority for the instance. If you don't select a value, the default is tier-1. This priority determines the order in which Aurora Replicas are promoted when recovering from a primary instance failure. For more information, see Fault Tolerance for an Aurora DB Cluster.

    Backtrack

    Applies only to Aurora MySQL. Select Enable Backtrack to enable backtracking or Disable Backtrack to disable backtracking. Using backtracking, you can rewind a DB cluster to a specific time, without creating a new DB cluster. It is disabled by default. If you enable backtracking, also specify the amount of time that you want to be able to backtrack your DB cluster (the target backtrack window). For more information, see Backtracking an Aurora DB Cluster.

    Backup retention period

    Select the length of time, from 1 to 35 days, that Aurora will retain backup copies of the database. Backup copies can be used for point-in-time restores (PITR) of your database down to the second.

    Enhanced Monitoring

    Choose Enable enhanced monitoring to enable gathering metrics in real time for the operating system that your DB cluster runs on. For more information, see Enhanced Monitoring.

    Monitoring Role

    Only available if Enhanced Monitoring is set to Enable enhanced monitoring. Choose the IAM role that you created to permit Amazon RDS to communicate with Amazon CloudWatch Logs for you, or choose Default to have RDS create a role for you named rds-monitoring-role. For more information, see Enhanced Monitoring.

    Granularity

    Only available if Enhanced Monitoring is set to Enable enhanced monitoring. Set the interval, in seconds, between when metrics are collected for your DB cluster.

    Auto minor version upgrade

    Select Enable auto minor version upgrade if you want to enable your Aurora DB cluster to receive minor DB Engine version upgrades automatically when they become available.

    The Auto minor version upgrade setting only applies to Aurora PostgreSQL DB clusters.

    For more information about engine updates for Aurora PostgreSQL, see Amazon Aurora PostgreSQL Database Engine Updates.

    For more information about engine updates for Aurora MySQL, see Amazon Aurora MySQL Database Engine Updates.

    Maintenance window

    Select Select window and specify the weekly time range during which system maintenance can occur. Or, select No preference for Amazon RDS to assign a period randomly.

    Enable deletion protection Select Enable deletion protection to prevent your DB cluster from being deleted. If you create a production DB cluster with the console, deletion protection is enabled by default.
  10. Choose Create database to create your Aurora DB instance, and then choose Close.

    On the Amazon RDS console, the new DB instance appears in the list of DB instances. The DB instance will have a status of creating until the DB instance is created and ready for use. When the state changes to available, you can connect to the primary instance for your DB cluster. Depending on the DB instance class and store allocated, it can take several minutes for the new instance to be available.

    To view the newly created cluster, choose the Clusters view in the Amazon RDS console and choose the DB cluster to show the DB cluster details. For more information, see Viewing an Amazon Aurora DB Cluster.

    
                            Amazon Aurora DB Instances List

    Note the port and the endpoint of the cluster. Use the endpoint and port of the cluster in your JDBC and ODBC connection strings for any application that performs write or read operations.

AWS CLI

Note

Before you can create an Aurora DB cluster using the AWS CLI, you must fulfill the required prerequisites, such as creating a VPC and an RDS DB subnet group. For more information, see DB Cluster Prerequisites.

You can use the AWS CLI to create an Aurora MySQL DB cluster or an Aurora PostgreSQL DB cluster.

To create an Aurora MySQL DB cluster using the AWS CLI

When you create an Aurora MySQL DB cluster or DB instance, ensure that you specify the correct value for the --engine option value based on the MySQL compatibility of the DB cluster or DB instance.

  • When you create an Aurora MySQL 5.7 DB cluster or DB instance, you must specify aurora-mysql for the --engine option.

  • When you create an Aurora MySQL 5.6 DB cluster or DB instance, you must specify aurora for the --engine option.

Complete the following steps:

  1. Identify the DB subnet group and VPC security group ID for your new DB cluster, and then call the create-db-cluster AWS CLI command to create the Aurora MySQL DB cluster.

    For example, the following command creates a new MySQL 5.7–compatible DB cluster named sample-cluster.

    For Linux, OS X, or Unix:

    aws rds create-db-cluster --db-cluster-identifier sample-cluster --engine aurora-mysql \ --engine-version 5.7.12 --master-username user-name --master-user-password password \ --db-subnet-group-name mysubnetgroup --vpc-security-group-ids sg-c7e5b0d2

    For Windows:

    aws rds create-db-cluster --db-cluster-identifier sample-cluster --engine aurora-mysql ^ --engine-version 5.7.12 --master-username user-name --master-user-password password ^ --db-subnet-group-name mysubnetgroup --vpc-security-group-ids sg-c7e5b0d2

    The following command creates a new MySQL 5.6–compatible DB cluster named sample-cluster.

    For Linux, OS X, or Unix:

    aws rds create-db-cluster --db-cluster-identifier sample-cluster --engine aurora \ --engine-version 5.6.10a --master-username user-name --master-user-password password \ --db-subnet-group-name mysubnetgroup --vpc-security-group-ids sg-c7e5b0d2

    For Windows:

    aws rds create-db-cluster --db-cluster-identifier sample-cluster --engine aurora ^ --engine-version 5.6.10a --master-username user-name --master-user-password password ^ --db-subnet-group-name mysubnetgroup --vpc-security-group-ids sg-c7e5b0d2
  2. If you use the console to create a DB cluster, then Amazon RDS automatically creates the primary instance (writer) for your DB cluster. If you use the AWS CLI to create a DB cluster, you must explicitly create the primary instance for your DB cluster. The primary instance is the first instance that is created in a DB cluster.

    Call the create-db-instance AWS CLI command to create the primary instance for your DB cluster. Include the name of the DB cluster as the --db-cluster-identifier option value.

    For example, the following command creates a new MySQL 5.7–compatible DB instance named sample-instance.

    For Linux, OS X, or Unix:

    aws rds create-db-instance --db-instance-identifier sample-instance \ --db-cluster-identifier sample-cluster --engine aurora-mysql --db-instance-class db.r4.large

    For Windows:

    aws rds create-db-instance --db-instance-identifier sample-instance ^ --db-cluster-identifier sample-cluster --engine aurora-mysql --db-instance-class db.r4.large

    The following command creates a new MySQL 5.6–compatible DB instance named sample-instance.

    For Linux, OS X, or Unix:

    aws rds create-db-instance --db-instance-identifier sample-instance \ --db-cluster-identifier sample-cluster --engine aurora --db-instance-class db.r4.large

    For Windows:

    aws rds create-db-instance --db-instance-identifier sample-instance ^ --db-cluster-identifier sample-cluster --engine aurora --db-instance-class db.r4.large

To create an Aurora PostgreSQL DB cluster using the AWS CLI

  1. Identify the DB subnet group and VPC security group ID for your new DB cluster, and then call the create-db-cluster AWS CLI command to create the Aurora PostgreSQL DB cluster.

    For example, the following command creates a new DB cluster named sample-cluster.

    For Linux, OS X, or Unix:

    aws rds create-db-cluster --db-cluster-identifier sample-cluster --engine aurora-postgresql \ --master-username user-name --master-user-password password \ --db-subnet-group-name mysubnetgroup --vpc-security-group-ids sg-c7e5b0d2

    For Windows:

    aws rds create-db-cluster --db-cluster-identifier sample-cluster --engine aurora-postgresql ^ --master-username user-name --master-user-password password ^ --db-subnet-group-name mysubnetgroup --vpc-security-group-ids sg-c7e5b0d2
  2. If you use the console to create a DB cluster, then Amazon RDS automatically creates the primary instance (writer) for your DB cluster. If you use the AWS CLI to create a DB cluster, you must explicitly create the primary instance for your DB cluster. The primary instance is the first instance that is created in a DB cluster.

    Call the create-db-instance AWS CLI command to create the primary instance for your DB cluster. Include the name of the DB cluster as the --db-cluster-identifier option value.

    For Linux, OS X, or Unix:

    aws rds create-db-instance --db-instance-identifier sample-instance \ --db-cluster-identifier sample-cluster --engine aurora-postgresql --db-instance-class db.r4.large

    For Windows:

    aws rds create-db-instance --db-instance-identifier sample-instance ^ --db-cluster-identifier sample-cluster --engine aurora-postgresql --db-instance-class db.r4.large
RDS API

Note

Before you can create an Aurora DB cluster using the AWS CLI, you must fulfill the required prerequisites, such as creating a VPC and an RDS DB subnet group. For more information, see DB Cluster Prerequisites.

Identify the DB subnet group and VPC security group ID for your new DB cluster, and then call the CreateDBInstance action to create the DB cluster.

When you create an Aurora MySQL DB cluster or DB instance, ensure that you specify the correct value for the Engine parameter value based on the MySQL compatibility of the DB cluster or DB instance.

  • When you create an Aurora MySQL 5.7 DB cluster or DB instance, you must specify aurora-mysql for the Engine parameter.

  • When you create an Aurora MySQL 5.6 DB cluster or DB instance, you must specify aurora for the Engine parameter.

When you create an Aurora PostgreSQL DB cluster or DB instance, specify aurora-postgresql for the Engine parameter.