Wordpress backed with Amazon RDS

Yashwanth Medisetti
4 min readMar 6, 2021

--

Wordpress is one of the most widely PHP platform for blogging about various interests of people using it. Since it has huge reach and demand it is necessary to ensure that the data inside this application given by the clients is stored and the data should be highly available. Using a normal MySQL backed database is a typical practice which ensures that the data is not lost.

But what about the data if the database is down at the time of client requests ????

Now it is important not only to maintain the database but also that the database is always up and is available to all the clients who use it. There shouldn’t be a downtime for the database. This service is taken by the highly popular service Amazon RDS , advanced database services of the amazon which provides high availability and least downtime to the database instances launched in the backend. They also provide some advanced features that can be linked to databases like Auto-Scaling , replication , etc.,.

To test this , we are going to use this database of the amazon (Amazon RDS) for a frontend wordpress PHP application deployed on top of an AWS instance. There are most importantly 2 steps in the whole procedure of doing so which are ;

  1. Installing the wordpress application on instance
  2. Configuring the Amazon RDS.

Moving to the first step , launch a typical amazon instance and install the packages named httpd , mysql , php7.2 using the commands :

yum install httpd mysql -y

amazon-linux-extras install php7.2 -y

Now download the wordpress application using the command ;

wget https://wordpress.org/latest.tar.gz

The package installed will be in a zipped folder as ;

The zipped folder can be unzipped using the command ;

tar -xvzf latest.tar.gz -C /var/www/html/

The above command opens the files and moves them to the /var/www/html which is the default root directory of the HTPD server so that the application can be exposed using the http services. Do not forget to allow the security groups of the instance to allow the http port to be exposed (inbound rule).

With successful installation of wordpress we can find the webpage at the URL “http://(public_IP)/wordpress”

Wordpress installed successfully

Moving on to the next step of configuring the Amazon RDS. Configuring it is a very straight forward process which includes the selection of database server that is preferred from some commonly used databases which include Oracle database , MySQL , NoSQL , etc.,. Select a suitable version of SQL to support the wordpress that is installed.

databases of Amazon RDS

Make sure that you launch the database in a free tier so that you won’t be charged for using the database.

Tier selection

Since it’s a database it is common to give a root password for the database and a root user. Here my root user is termed as “admin” and I’ve used a password authentication. A private key authentication can also be used.

Authentication

Allow the security groups to allow the database for public use (not preferable) and finally create a user so that the database can be connected to the user when reaching the database from a remote client program like wordpress.

Public Access of AWS RDS
User creation

Hence create the database. Finally retrieve the endpoint of the RDS database so that it can be collected from the external programs. Switching back to the wordpress , provide the installation details that require database host , database user and database password so that it can be linked to the database to store it’s data.

With the wordpress successfully installed and integrated to a backend database. Create some content to store the data in Amazon RDS — database services.

Hello World

--

--