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. By default, the DB cluster contains a primary writer DB instance and, optionally, up to 15 Aurora Replicas (reader DB instances). For more information about Aurora DB clusters, see Amazon Aurora DB clusters.
In the following topic, you can find out how to create an Aurora DB cluster. To get started, first see DB cluster prerequisites.
For simple instructions on connecting to your Aurora DB cluster, see Connecting to an Amazon Aurora DB cluster.
DB cluster prerequisites
Before you can create an Aurora DB cluster, you must complete the tasks in Setting up your environment for Amazon Aurora.
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) based on the Amazon VPC service, 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, you can have Amazon RDS automatically create a VPC for you. Or 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 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 Aurora.
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 haven't created a VPC, you can have Amazon RDS automatically create a VPC for you when you create an Aurora DB cluster using the console. Otherwise, you must do the following:
-
Create a VPC with at least one subnet in each of at least two of the Availability Zones in the AWS Region where you want to deploy your DB cluster. For more information, see How to create a VPC for use with Amazon Aurora.
-
Specify a VPC security group that authorizes connections to your Aurora DB cluster. For more information, see Working with a DB instance in a VPC.
-
Specify an RDS DB subnet group that defines at least two subnets in the VPC that can be used by the Aurora DB cluster. For more information, see Working with DB subnet groups.
Additional prerequisites
If you are connecting to AWS using AWS Identity and Access Management (IAM) credentials, your AWS account must have IAM policies that grant the permissions required to perform Amazon RDS operations. For more information, see Identity and access management in Amazon Aurora.
If you are using IAM to access the Amazon RDS console, you must first sign on to the
AWS Management Console with your IAM user credentials. 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 to 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.
If you are using the console, a new console interface is available for database creation. Choose either the New Console or the Original Console instructions based on the console that you are using. The New Console instructions are open by default.
You can create a DB instance running MySQL with the AWS Management Console with Easy create enabled or not enabled. With Easy create enabled, you specify only the DB engine type, DB instance size, and DB instance identifier. Easy Create uses the default setting for other configuration options. With Easy create not enabled, you specify more configuration options when you create a database, including ones for availability, security, backups, and maintenance.
For this example, Standard Create is enabled, and Easy Create isn't enabled. For information about creating an Aurora MySQL DB cluster with Easy create enabled, see Getting started with Amazon Aurora.
To create an Aurora DB cluster using the console
-
Sign in to the AWS Management Console and open the Amazon RDS console at https://console.aws.amazon.com/rds/
. -
In the upper-right corner of the AWS Management Console, choose the AWS Region in which you want to create the DB cluster.
Aurora is not available in all AWS Regions. For a list of AWS Regions where Aurora is available, see Region availability.
-
In the navigation pane, choose Databases.
-
Choose Create database.
-
In Choose a database creation method, choose Standard Create.
-
In Engine options, choose Amazon Aurora.
-
In Edition, choose one of the following:
-
Amazon Aurora with MySQL compatibility
-
Amazon Aurora with PostgreSQL compatibility
-
-
If you chose Amazon Aurora with MySQL compatibility, choose one of the following in Database features:
-
One writer and multiple readers
For more information, see Amazon Aurora DB clusters.
-
Serverless
For more information, see Using Amazon Aurora Serverless v1.
-
-
In Templates, choose the template that matches your use case.
-
To enter your master password, do the following:
-
In the Settings section, open Credential Settings.
-
Clear the Auto generate a password check box.
-
(Optional) Change the Master username value and enter the same password in Master password and Confirm password.
By default, the new DB instance uses an automatically generated password for the master user.
-
-
For the remaining sections, specify your DB cluster settings. For information about each setting, see Settings for Aurora DB clusters.
-
Choose Create database.
If you chose to use an automatically generated password, the View credential details button appears on the Databases page.
To view the master user name and password for the DB cluster, choose View credential details.
To connect to the DB instance as the master user, use the user name and password that appear.
Important You can't view the master user password again. If you don't record it, you might have to change it. If you need to change the master user password after the DB instance is available, you can modify the DB instance to do so. For more information about modifying a DB instance, see Modifying an Amazon Aurora DB cluster.
-
For Databases, choose the name of the new Aurora DB cluster.
On the RDS console, the details for new DB cluster appear. The DB cluster and its DB instance have a status of creating until the DB cluster is ready to use. When the state changes to available for both, you can connect to the DB cluster. Depending on the DB instance class and the amount of storage, it can take up to 20 minutes before the new DB cluster is available.
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 Databases from the navigation pane in the Amazon RDS console. Then choose the DB cluster to show the DB cluster details. For more information, see Viewing an Amazon Aurora DB cluster.
On the Connectivity & security tab, note the port and the endpoint of the writer DB instance. Use the endpoint and port of the cluster in your JDBC and ODBC connection strings for any application that performs write or read operations.
To create an Aurora DB cluster using the AWS Management Console
-
Sign in to the AWS Management Console and open the Amazon RDS console at https://console.aws.amazon.com/rds/
. -
In the top-right corner of the AWS Management Console, choose the AWS Region in which you want to create the Aurora DB cluster.
-
In the navigation pane, choose Databases.
If the navigation pane is closed, choose the menu icon at the top left to open it.
-
Choose Create database to open the Select engine page.
-
On the Select engine page, choose an edition of Aurora. Choose either MySQL 5.6-compatible, MySQL 5.7-compatible, or PostgreSQL-compatible.
-
Choose Next.
-
On the Specify DB details page, specify your DB instance information. For information about each setting, see Settings for Aurora DB clusters.
A typical Specify DB details page looks like the following.
-
Confirm your master password and choose Next.
-
On the Configure advanced settings page, you can customize additional settings for your Aurora DB cluster. For information about each setting, see Settings for Aurora DB clusters.
-
Choose Create database to create your Aurora DB cluster, and then choose Close.
On the Amazon RDS console, the new DB cluster appears in the list of DB clusters. The DB cluster will have a status of creating until the DB cluster is created and ready for use. When the state changes to available, you can connect to the writer instance for your DB cluster. Depending on the DB cluster class and store allocated, it can take several minutes for the new cluster to be available.
To view the newly created cluster, choose Databases from the navigation pane 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.
Note the ports and the endpoints of the cluster. Use the endpoint and port of the writer DB cluster in your JDBC and ODBC connection strings for any application that performs write or read operations.
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:
-
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, macOS, 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-passwordpassword
\ --db-subnet-group-name mysubnetgroup --vpc-security-group-ids sg-c7e5b0d2For 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-passwordpassword
^ --db-subnet-group-name mysubnetgroup --vpc-security-group-ids sg-c7e5b0d2The following command creates a new MySQL 5.6–compatible DB cluster named
sample-cluster
.For Linux, macOS, 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-passwordpassword
\ --db-subnet-group-name mysubnetgroup --vpc-security-group-ids sg-c7e5b0d2For Windows:
aws rds create-db-cluster --db-cluster-identifier sample-cluster --engine aurora ^ --engine-version 5.6.10a --master-username
user-name
--master-user-passwordpassword
^ --db-subnet-group-name mysubnetgroup --vpc-security-group-ids sg-c7e5b0d2 -
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, macOS, 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, macOS, 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
-
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, macOS, or Unix:
aws rds create-db-cluster --db-cluster-identifier sample-cluster --engine aurora-postgresql \ --master-username
user-name
--master-user-passwordpassword
\ --db-subnet-group-name mysubnetgroup --vpc-security-group-ids sg-c7e5b0d2For Windows:
aws rds create-db-cluster --db-cluster-identifier sample-cluster --engine aurora-postgresql ^ --master-username
user-name
--master-user-passwordpassword
^ --db-subnet-group-name mysubnetgroup --vpc-security-group-ids sg-c7e5b0d2 -
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, macOS, 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
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 operation 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 theEngine
parameter. -
When you create an Aurora MySQL 5.6 DB cluster or DB instance, you must specify
aurora
for theEngine
parameter.
When you create an Aurora PostgreSQL DB cluster or DB instance, specify aurora-postgresql
for the
Engine
parameter.
Settings for Aurora DB clusters
The following table contains details about settings that you choose when you create an Aurora DB cluster.
For this option | Do this |
---|---|
Availability zone |
Determine if you want to specify a particular Availability Zone. For more information about Availability Zones, see Regions and Availability Zones . |
Auto minor version upgrade |
Choose Enable auto minor version upgrade if you want to enable your Aurora DB cluster to receive preferred minor version upgrades to the DB engine automatically when they become available. The Auto minor version upgrade setting applies to botn Aurora PostgreSQL and Aurora MySQL DB clusters. For Aurora MySQL 1.x and 2.x clusters, this setting upgrades the clusters to a maximum version of 1.22.2 and 2.07.2. For more information about engine updates for Aurora PostgreSQL, see Database engine updates for Amazon Aurora PostgreSQL . For more information about engine updates for Aurora MySQL, see Database engine updates for Amazon Aurora MySQL. |
Backtrack |
Applies only to Aurora MySQL. Choose 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. |
Copy tags to snapshots |
Choose this option to copy any DB instance tags to a DB snapshot when you create a snapshot. For more information, see Tagging Amazon RDS resources. |
Database authentication |
The database authentication option you want to use. Choose Password authentication to authenticate database users with database passwords only. Choose Password and IAM DB authentication to authenticate database users with database passwords and user credentials through IAM users and roles. For more information, see IAM database authentication. |
Database port |
Specify the port for applications and utilities to 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 cluster identifier |
Enter a name for your DB cluster that is unique for your account in the AWS Region that you chose. This identifier is 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:
|
DB cluster parameter group |
Choose 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. |
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 DB instance classes. |
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:
|
DB parameter group |
Choose 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. |
Enable deletion protection | Choose 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. |
Enable encryption |
Choose |
Enable 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 Using Enhanced Monitoring. |
Enable Performance Insights |
Choose |
Failover priority |
Choose a failover priority for the instance. If you don't choose 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. |
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. |
Initial database name |
Enter a name for your default database. If you don't
provide a name for an Aurora MySQL DB cluster, Amazon RDS doesn't create a database
on the DB
cluster you are creating. If you don't provide a name for an Aurora PostgreSQL DB
cluster,
Amazon RDS creates a database named For Aurora MySQL, the default database name has these constraints:
For Aurora PostgreSQL, the default database name has these constraints:
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. |
Log exports |
Choose the types of MySQL or PostgreSQL database log files to generate. For more information, see MySQL database log files and PostgreSQL database log files. |
Maintenance window |
Choose Select window and specify the weekly time range during which system maintenance can occur. Or choose No preference for Amazon RDS to assign a period randomly. |
Master key |
Only available if Encryption is set to Enable encryption. Choose the master key to use for encrypting this DB cluster. For more information, see Encrypting Amazon Aurora resources. |
Option group |
Aurora has a default option group. |
Master password |
Enter a password to log on to your DB cluster:
|
Master username |
Enter a name to use as the master user name to log on to your DB cluster:
|
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
|
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 Regions and Availability Zones . |
Option group |
Aurora has a default option group. |
Performance Insights |
Doesn't apply to MySQL 5.6. Choose Enable Performance Insights if you want to use Amazon RDS Performance Insights to monitor your Amazon Aurora DB cluster load. For more information about Performance Insights, see Using Performance Insights on Amazon Aurora. |
Public access |
Choose Publicly accessible to give the DB cluster a public IP address, or choose Not publicly accessible. 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. To connect to a DB instance from outside of its Amazon VPC, the DB instance must be publicly accessible, access must be granted using the inbound rules of the DB instance's security group, and other requirements must be met. For more information, see Can't connect to Amazon RDS DB instance. If your DB instance is isn't publicly accessible, you can also use an AWS Site-to-Site VPN connection or an AWS Direct Connect connection to access it from a private network. For more information, see Internetwork traffic privacy. |
Retention period |
Choose the length of time, from 1 to 35 days, that Aurora retains backup copies of the database. Backup copies can be used for point-in-time restores (PITR) of your database down to the second. |
Subnet group |
Choose the DB subnet group to use for the DB cluster. For more information, see DB cluster prerequisites. |
Select the log types to publish to Amazon CloudWatch Logs |
Applies only to Aurora MySQL. In the Log exports section, choose the logs that you want to start publishing to Amazon CloudWatch Logs. For more about publishing to CloudWatch Logs, see Publishing Amazon Aurora MySQL logs to Amazon CloudWatch Logs. |
Virtual Private Cloud (VPC) |
Choose the VPC to host the DB cluster. Choose Create a New VPC to have Amazon RDS create a VPC for you. For more information, see DB cluster prerequisites. |
VPC security group |
Choose Create new to have Amazon RDS create a VPC security group for you. Or choose Choose existing and specify one or more VPC security groups to secure network access to the DB cluster. When you choose Create new in the RDS console, a new security group is created with an inbound rule that allows access to the DB instance from the IP address detected in your browser. For more information, see DB cluster prerequisites. |