Task 2: Create an RDS database and automatically connect it to your EC2 instance - Amazon Elastic Compute Cloud
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Task 2: Create an RDS database and automatically connect it to your EC2 instance

Task objective

The objective of this task is to create an RDS database and use the automatic connection feature in the RDS console to automatically configure the connection between your EC2 instance and your RDS database.

Steps to create an RDS database

Use the following steps to create an RDS database and connect it to your EC2 instance using the automatic feature in the RDS console.

To view an animation of these steps, see View an animation: Create an RDS database and automatically connect it to an EC2 instance.

DB instance configuration

The steps in this task configure the DB instance as follows:

  • Engine type: MySQL

  • Template: Free tier

  • DB instance identifier: tutorial-database

  • DB instance class: db.t3.micro

Important

In a production environment, you should configure your instance to meet your specific needs.

To create an RDS database and automatically connect it to an EC2 instance
  1. Open the Amazon RDS console at https://console.amazonaws.cn/rds/.

  2. From the Region selector (at top right), choose the Amazon Web Services Region in which you created the EC2 instance. The EC2 instance and the RDS database must be in the same Region.

  3. On the dashboard, choose Create database.

  4. Under Choose a database creation method, check that Standard create is selected. If you choose Easy create, the automatic connection feature is not available.

  5. Under Engine options, for Engine type, choose MySQL.

  6. Under Templates, choose a sample template to meet your needs. For this tutorial, choose Free tier to create an RDS database at no cost. However, note that the free tier is only available if your account is less than 12 months old. Other restrictions apply. You can read more by choosing the Info link in the Free tier box.

  7. Under Settings, do the following:

    1. For DB instance identifier, enter a name for the database. For this tutorial, enter tutorial-database.

    2. For Master username, leave the default name, which is admin.

    3. For Master password, enter a password that you can remember for this tutorial, and then, for Confirm password, enter the password again.

  8. Under Instance configuration, for DB instance class, leave the default, which is db.t3.micro. If your account is less than 12 months, you can use this instance for free. Other restrictions apply. For more information, see Amazon Free Tier.

  9. Under Connectivity, for Compute resource, choose Connect to an EC2 compute resource. This is the automatic connection feature in the RDS console .

  10. For EC2 instance, choose the EC2 instance that you want to connect to. For the purposes of this tutorial, you can either choose the instance that you created in the previous task, which you named tutorial-instance, or choose another existing instance. If you don't see your instance in the list, choose the refresh icon to the right of Connectivity.

    When you use the automatic connection feature, a security group is added to this EC2 instance, and another security group is added to the RDS database. The security groups are automatically configure to allow traffic between the EC2 instance and the RDS database. In the next task, you'll verify that the security groups were created and assigned to the EC2 instance and RDS database.

  11. Choose Create database.

    On the Databases screen, the Status of the new database is Creating until the database is ready to use. When the status changes to Available, you can connect to the database. Depending on the database class and the amount of storage, it can take up to 20 minutes before the new database is available.

To learn more, see Configure automatic network connectivity with an EC2 instance in the Amazon RDS User Guide.


								This animation shows how to create an RDS database, and then
									use the automatic connection functionality to connect it to an
									EC2 instance. For the text version of this animation, see the
									steps in the preceding procedure.

You're now ready for Task 3: Verify the connection configuration.