Getting Started with AWS

Deploy WordPress

with Amazon RDS

Module 1: Creating a MySQL Database with RDS

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

Introduction

At this point, you have created an RDS database and an EC2 instance. In this module, we will configure the RDS database to allow access to specific entities.

What You Will Learn

  • How to create a MySQL database for your WordPress site
  • Why WordPress needs a MySQL database and why Amazon RDS is a good choice for your database needs

 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 which have user-submitted comments. A relational database is a good choice for storing hierarchical data like this. Further, MySQL is the most popular open source database, and it 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 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

  • Create your MySQL Database

    To begin, go to Amazon RDS in the AWS console. Click the orange Create database button to get started.

    Click the orange create database button

    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 that engine now.

    Select MySQL

    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:

    Select Free Tier if you would like to use this lab for learning without spending any money

    Next, you will specify the authentication settings for your MySQL deployment. This includes 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.

    In the settings section, enter wordpress as your DB instance identifier

    After setting your username and password, you can select key details about your MySQL 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.

    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.

    Click on the Additional configuration line to expand the options

    Set the initial database name to wordpress. This will ensure RDS creates the database in your MySQL instance upon initialization. You will use this database name when connecting to your database.

    Set the initial database name to wordpress

    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 Amazon 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.

    Click the orange Create database button to create your database

    You should see a success notice indicating that your database is being created.

    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.

Was this module helpful?

Thank you
Please let us know what you liked.
Close
Sorry to disappoint you
Is something out-of-date, confusing or inaccurate? Please help us improve this tutorial by providing feedback.
Close

Creating an EC2 Instance