Deploy WordPress with Amazon RDS

Module 1

Module 1: Creating a MySQL Database with Amazon RDS

In this module, you will create a MySQL database for your WordPress site

Overview

In this module, you will create an Amazon RDS database and configure it to allow access to specific entities.

What you will accomplish

In this module, you will create a MySQL database for your WordPress site.

 Time to complete

5 minutes

 Services used

Why does WordPress need MySQL?

WordPress is a flexible content management system for building blogs, e-commerce sites, discussion boards, and more. For whatever kind of website you’re making, you will have content to store. In a blog, this will be your blog posts and comments. In an e-commerce site, it will be your products and user accounts.

This content needs to be permanently stored somewhere. WordPress uses MySQL to store this content. A lot of the data in a WordPress application is hierarchical, structured data. For example, your application may have blog posts that have user-submitted comments. A relational database is a good choice for storing hierarchical data like this. Further, MySQL is a popular open source database, and is a reliable, performant choice for this application.

Why use Amazon RDS for your WordPress database?

Many installation guides for WordPress use a MySQL database that is on the same server as the WordPress installation. While this may be sufficient to start, there are a number of reasons you may not want your MySQL database on the same server as your WordPress installation:

  • MySQL and WordPress will be competing for compute resources on the same server, potentially hurting your site’s performance.
  • You are unable to horizontally scale WordPress by adding additional WordPress servers as your site becomes more popular.
  • You are responsible for all database maintenance tasks, including database backups and security upgrades.

By using Amazon RDS for MySQL, these concerns go away. Your database will be on a separate instance than your WordPress installation, so they won’t be competing for resources. Further, you can create multiple WordPress installations that connect to a single MySQL instance on Amazon RDS, allowing you to scale your site horizontally. Finally, Amazon RDS for MySQL has automated backups and security patches to help you with your database administration.

In the steps below, you will launch a MySQL database using the AWS Management Console.

Implementation

  • a. Open the AWS Management Console. When the screen loads, enter RDS in the search bar, then select RDS to open the service console.

    b. Choose the Create database button to get started.

    c. 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.
     
    WordPress uses MySQL, so select Standard create for the database creation method and choose the MySQL engine.

    d. 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 to complete the learning in this guide without incurring costs.

    In a production setup, you may want to use features of Amazon RDS that are outside the Free Tier. These include:

    e. Next, you will specify the authentication settings for your MySQL deployment. These include the database name and the master username and password.

    In the Settings section, enter wordpress 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.

    f. After setting your username and password, you can select key details about your MySQL deployment. This includes the instance configuration and storage details.
     
    The default settings will work for this guide. 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.

    g. Next, you can configure connectivity and network settings. 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 guide. 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 Amazon RDS instance in this VPC.

    h. Finally, Amazon RDS provides a number of additional configuration options to customize your deployment. You need to make one change in this area. Select the Additional configuration line to expand the options. Set the Initial database name to wordpress. This will ensure Amazon RDS creates the database in your MySQL instance upon initialization. You will use this database name when connecting to your database.

    i. Retain the default settings for the remainder of options. At the bottom of the creation wizard, AWS will show you estimated monthly costs for your Amazon RDS database. If you are still eligible for the Amazon RDS Free Tier, you will see a note that the database will be free to you for up to 12 months.

    Choose the Create database button to create your database.
    j. You should see a success notice indicating that your database is being created.

    In this module, you created a fully managed MySQL database using Amazon RDS. In the next module, you will create an Amazon EC2 instance for running your WordPress site.

Creating an EC2 Instance

Was this page helpful?