Module 1: Creating a MySQL or PostgreSQL database with RDS
To get started, you will create a database for your Drupal site.
Background and Setup
In this module, you will create a database for your Drupal site. Before you walk through the steps to create a database with Amazon RDS, you will learn why Drupal needs a database and which databases you can use with Drupal. You will also learn why you should use a managed database service like Amazon RDS for your database needs.
Why does Drupal need a database?
Drupal is a content management system that can be used for blogs, corporate sites, and more. The core aspect of a content management system is the content itself. When using Drupal, you will be writing copy for landing pages or storing videos for display on your site. All of this content needs to be persisted somewhere to be shown to users.
To store this data, Drupal requires a relational database. There are a number of popular relationa; databases, both open-source and proprietary, and Drupal supports a variety of database engines.
Why use Amazon RDS for your Drupal database?
If you read a quick-start installation guide for configuring Drupal, it may have you install a relational database on the same server as your Drupal installation. This is easier to set up in the beginning, but it may hurt you in the long run.
Eventually, you will want your Drupal database on a separate server from your Drupal installation for the following reasons:
- You can scale your Drupal installation onto multiple instances as your traffic grows;
- You can handle database failover and disaster recovery separately from your Drupal failover and recovery plans;
- Your database and Drupal installation won’t be competing for the same CPU and network resources.
Using Amazon RDS for your database needs helps with these problems. With Amazon RDS, your database is on a dedicated instance separate from your Drupal installation, allowing you to connect from multiple instances of your Drupal site to assist with scaling. Further, database failover and backups are automated with Amazon RDS so you can sleep easy without worrying about your database. Finally, you can scale your relational database separately from your Drupal instances, allowing you to provision the right amount of resources for your database.
In the steps below, you will launch a database using the Amazon RDS console. There are steps for configuring a MySQL database or a PostgreSQL database, so choose the database engine that you prefer. You only need to configure one database for this lab.
Create your RDS database
To begin, go to Amazon RDS in the AWS console. Click the orange Create database button to get started.
The first step is to choose the database engine you want to use. Amazon RDS supports six different engines, from popular open-source options like MySQL and PostgreSQL, to commercial options like Oracle and Microsoft SQL Server, to a cloud-native option called Amazon Aurora that was custom-built to take advantage of the cloud.
You can use either MySQL or PostgreSQL with a Drupal website. Choose whichever database engine you prefer.
In the Templates section of the creation wizard, there is an option to only show options that are available in the AWS Free Tier. Select this option now if you would like to use this lab for learning without spending any money.
In a production setup, you may want to use features of Amazon RDS that are outside the free tier. These include:
Next, you will specify the authentication settings for your RDS deployment. This includes the database name and the master username and password.
In the Settings section, enter drupal as your DB instance identifier. Then specify the master username and password for your database. Choose a strong, secure password to help protect your database. Store the username and password for safekeeping as you will need it in a later module.
After setting your username and password, you can select key details about your RDS deployment. This includes the instance class and storage details.
The default settings will work for this lab. You will use a small instance class that is suitable for testing or small-scale applications, and it fits within the AWS Free Tier. If you don’t want to use the AWS Free Tier, you could set a larger instance class or alter the storage configuration options.
Next, you can configure connectivity and network configuration. Amazon RDS instances must be created in an Amazon VPC, which is a logically-separate network where your provisioned resources will live.
VPCs are an advanced topic outside the scope of this lab. Fortunately, AWS has created a default VPC in each region in your account. The default VPC is already selected for you, and you can launch your RDS instance in this VPC.
Finally, RDS provides a number of additional configuration options to customize your deployment. You need to make one change in this area. Click on the Additional configuration line to expand the options.
Set the initial database name to drupal. This will ensure RDS creates the database in your MySQL instance upon initialization. You will use this database name when connecting to your database.
At the bottom of the creation wizard, AWS will show you estimated monthly costs for your RDS database. If you are still eligible for the AWS RDS Free Tier, you will see a note that the database will be free to you for up to 12 months.
Click the orange Create database button to create your database.
You should see a success notice indicating that your database is being created.
In this module, you created a fully-managed relational database using Amazon RDS. In the next module, you will create an Amazon EC2 instance for running your Drupal site.