Deploying WordPress with Amazon RDS

Shivani Mandloi
5 min readMar 24, 2021

Introductionđź“„

WordPress is a free and open-source content management system (CMS) written in PHP and paired with a MySQL or MariaDB database which is used for over 30% of all sites over the internet.

here, My blog would explain how to set up a WordPress site. you can use the MySQL application as well.

Then why using Amazon RDS is preferred?

Son Maintaining any Website database is critical since it contains all our important data. if this database goes down it would result in our website crash.

Amazon RDS helps to manage our database. also, WordPress requires a MySQL database for storing our data.

Task Descriptionđź“„

👉 Launching an AWS EC2 instance and Configuring this instance with Apache Webserver.

👉For deploying WordPress we need to download the PHP application name “WordPress”.

👉Now, WordPress needs a backend MySQL database server. so, to set up a MySQL server I am using AWS RDS service using Free Tier.

👉Providing the endpoint/connection string to the WordPress application to make it work.

let's start..!!!

  1. Launching Ec2 instance with following security group inbound rules

here I am allowing HTTP traffic since this instance is for the Wordpress website.

also, I am allowing ssh traffic so that we can connect with putty remotely for further configuration.

please copy the security group or rename it since we will need it later on.

2. Now let's create a MySQL database with AWS RDS.

Go to Amazon RDS service console, click create database

Now, WordPress uses MySQL, so select the database engine MySQL.

In the Settings section, enter wordpress as your DB instance identifier. Then specify the master username and password for your database.

In DB Instance size select option Burstable classes

Here, I am adding an initial database that as the database instance launch it will have pre-created database with the name “wordpress”.

Create Database.

3. After creating the database you need to edit the security group

so add an inbound rule allowing traffic MySQL/aurora and add the same security group in the source section which you created while launching your ec2-instance.

4. Now, remotely log in to your ec2-instance

here, we will create a database user, first install MySQL client to interact with your RDS database using command

Now saving even variable for MYSQL host which is the hostname of Our RDS database

find your hostname for your RDS database in the AWS console. In the details of your RDS database, the hostname will be shown as the Endpoint in the Connectivity & security section.

to connect to the MySQL database

#mysql --user=<user> --password=<password> wordpress

here, enter the master username and password you configured when creating your RDS database.

create a user for your database and grant permissions.

5. Now, to Configuring WordPress application in your ec2-instance

first, install the apache webserver using the command

Now, Download WordPress software using the command

This downloaded software is in a compressed format to you need to uncompress it using the command

#tar -xzf latest.tar.gz

Change into the wordpress directory and create a copy of the default config file using the following commands

now, here, you need to configure wordpress. so, go to the wordpress configuration file and do further changes as follows

The values should be:

● DB_NAME: “wordpress”

â—Ź DB_USER: The name of the database user you created.

â—Ź DB_PASSWORD: password for the user you created.

â—Ź DB_HOST: The hostname of the RDS database.

there are some more applications that WordPress requires behind the scene

which is MariaDB software.

so installed it using the command.

Now to tell your Apache server that you need to show WordPress application

you need to copy the wordpress/* file to the root directory of the apache webserver that is /var/www/html

using command

since we made changes in the root directory you need to restart our httpd service.

Now you can check your service via Public DNS (IPv4) of your ec2 instance.

Create your WordPress account.

our website

Hope you all find it informative..!!!

Thankyou..!!!

--

--