Menu
Amazon Relational Database Service
User Guide (API Version 2014-10-31)

Creating a DB Cluster and Connecting to a Database on an Amazon Aurora DB Instance

The easiest way to create an Amazon Aurora DB cluster is to use the Amazon RDS console. Once you have created the DB cluster, you can use standard MySQL utilities such as MySQL Workbench to connect to a database on the DB cluster.

Important

You must complete the tasks in the Setting Up for Amazon RDS section before you can create or connect to a DB cluster.

Create a DB Cluster

Before you create a DB cluster, you must first have an Amazon Virtual Private Cloud (VPC) and an Amazon RDS DB subnet group. Your VPC must have at least two subnets in at least two Availability Zones. You can use the default VPC for your AWS account, or you can create your own VPC. The Amazon RDS console makes it easy for you to create your own VPC for use with Amazon Aurora or use an existing VPC with your Aurora DB cluster.

If you want to create a VPC and DB subnet group for use with your Amazon Aurora DB cluster yourself, rather than having Amazon RDS create the VPC and DB subnet group for you, then follow the instructions in How to Create a VPC for Use with Amazon Aurora. Otherwise, follow the instructions in this topic to create your DB cluster and have Amazon RDS create a VPC and DB subnet group for you.

Note

Aurora is not available in all AWS regions. For a list of regions where Aurora is available, see Availability.

To launch an Aurora DB cluster

  1. Open the Amazon Aurora console at https://console.aws.amazon.com/rds.

  2. In the top-right corner of the AWS Management Console, choose the region that you want to create your DB cluster in. For a list of regions where Aurora is available, see Availability.

  3. In the left navigation pane, choose Instances.

  4. Choose Launch DB Instance to start the Launch DB Instance Wizard. The wizard opens on the Select Engine page.

  5. On the Select Engine page, choose the Select button for the Aurora DB engine.

    
									Amazon Aurora Launch DB Instance Wizard Select Engine
  6. Set the following values on the Specify DB Details page:

    • DB Instance Class: db.r3.large

    • DB Instance Identifier: gs-db-instance1

    • Master Username: Using alphanumeric characters, type a master user name, used to log on to your DB instances in the DB cluster.

    • Master Password and Confirm Password: Type a password in the Master Password box that contains from 8 to 41 printable ASCII characters (excluding /,", and @) for your master user password, used to log on to your database. Then type the password again in the Confirm Password box.

    
									Specify DB Details Page
  7. Choose Next and set the following values on the Configure Advanced Settings page:

    • VPC ID: If you have an existing VPC, then you can use that VPC with your Amazon Aurora DB cluster by choosing your VPC identifier, for example vpc-a464d1c1. For information on using an existing VPC, see How to Create a VPC for Use with Amazon Aurora.

      Otherwise, you can choose to have Amazon RDS create a VPC for you by choosing Create a new VPC. This example uses the Create a new VPC option.

    • Subnet Group: If you have an existing subnet group, then you can use that subnet group with your Amazon Aurora DB cluster by choosing your subnet group identifier, for example, gs-subnet-group1.

      Otherwise, you can choose to have Amazon RDS create a subnet group for you by choosing Create a new subnet group. This example uses the Create a new subnet group option.

    • Publicly Accessible: Yes

      Note

      Your production DB cluster might not need to be in a public subnet, because only your application servers will require access to your DB cluster. If your DB cluster doesn't need to be in a public subnet, set Publicly Accessible to No.

    • Availability Zone: No Preference

    • VPC Security Group(s): If you have one or more existing VPC security groups, then you can use one or more of those VPC security groups with your Amazon Aurora DB cluster by choosing your VPC security group identifiers, for example, gs-security-group1.

      Otherwise, you can choose to have Amazon RDS create a VPC security group for you by choosing Create a new Security group. This example uses the Create a new Security group option.

    • DB Cluster Identifier: gs-db-cluster1

    • Database Name: sampledb

      Note

      This creates the default database. 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: 3306

      Note

      You might be behind a corporate firewall that does not allow access to default ports such as the MySQL default port, 3306. In this case, provide a port value that your corporate firewall allows. Remember that port value later when you connect to the Aurora DB cluster.

    
									Configure Advanced Settings Page
  8. Leave the rest of the values as their defaults, and choose Launch DB Instance to create the DB cluster and primary instance.

Connect to an Instance in a DB Cluster

Once Amazon RDS provisions your DB cluster and creates the primary instance, you can use any standard SQL client application to connect to a database on the DB cluster. In this example, you connect to a database on the DB cluster using MySQL monitor commands. One GUI-based application that you can use to connect is MySQL Workbench. For more information, go to the Download MySQL Workbench page.

To connect to a database on a DB cluster using the MySQL monitor

  1. Open the Amazon Aurora console at https://console.aws.amazon.com/rds.

  2. Choose Clusters and choose the DB cluster from the list to show the DB cluster details. On the details page, copy the value for the endpoint. This endpoint is the cluster endpoint.

    
						DB Cluster Details
  3. Type the following command at a command prompt on a client computer to connect to a database on a DB cluster using the MySQL monitor. Use the cluster endpoint to connect to the primary instance, and the master user name that you created previously (you are prompted for a password). If you supplied a port value other than 3306, use that for the -P parameter instead.

    Copy
    PROMPT> mysql -h <endpoint> -P 3306 -u <mymasteruser> -p

    You will see output similar to the following.

    Copy
    Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 350 Server version: 5.6.10-log MySQL Community Server (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>

Delete the Sample DB Cluster, DB Subnet Group, and VPC

Once you have connected to the sample DB cluster that you created, you can delete the DB cluster, DB subnet group, and VPC (if you created a VPC).

To delete a DB cluster

  1. Open the Amazon Aurora console at https://console.aws.amazon.com/rds.

  2. Choose Instances and then choose the gs-db-instance1 DB instance.

  3. Choose Instance Actions, and then choose Delete on the dropdown menu.

  4. Choose Yes, Delete.

To delete a DB subnet group

  1. Open the Amazon Aurora console at https://console.aws.amazon.com/rds.

  2. Choose Subnet Groups and then choose the gs-subnet-group1 DB subnet group.

  3. Choose Delete.

  4. Choose Yes, Delete.

To delete a VPC

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

  2. Choose Your VPCs and then choose the VPC that was created for this procedure.

  3. Choose Delete.

  4. Choose Yes, Delete.