Configuring a Database Server using AWS RDS and launching a WordPress application on its Front End server on AWS EC2
What is AWS RDS?
Amazon Relational Database Service is a distributed relational database service by Amazon Web Services. It is a web service running “in the cloud” designed to simplify the setup, operation, and scaling of a relational database for use in applications.
What is WordPress?
WordPress is a free and open-source content management system written in PHP and paired with a MySQL or MariaDB database. It’s features include a plugin architecture and a template system, referred to within WordPress as Themes.
What is AWS EC2?
Amazon Elastic Compute Cloud is a part of Amazon.com’s cloud-computing platform, Amazon Web Services, that allows users to rent virtual computers on which to run their own computer applications.
Problem Statement
Task Description📄
🔅 Create an AWS EC2 instance
🔅 Configure the instance with Apache Webserver.
🔅 Download php application name “”WordPress””.
🔅 As wordpress stores data at the backend in MySQL Database server. Therefore, you need to setup a MySQL server using AWS RDS service using Free Tier.
🔅 Provide the endpoint/connection string to the WordPress application to make it work.
Solution Steps
Step 1:- Setup 2 security groups and launch the front end ec2 instance .
- For WordPress Front end server, where we will allow inbound at port number 22 and port number 80
2. For the MySQL database server, where we will allow inbound only through front end server as my data present here is very critical.
Launch the EC2 Instance with the front end server security group
Step 2:- Login into the front end server ,install the following packages and run the following commands.
- Install the HTTPD package to configure web server.
- Install the PHP package as wordpress is written in PHP language.
- Install the php-mysql extension as the wordpress package requires these extensions to work.
Install the further dependencies:- lamp-mariadb10.2-php7.2 ,via the amazon-linux-extras command.
Run the following commands to download the wordpress package in the document root of the apache web server, i.e. /var/www/html , make it executable and start the httpd server.
Step 3:- Check the server status
The server is running.
Step 4:- Now, we will setup the database server, using the AWS RDS
- We will setup MySQL database server
Set the username as admin and the password of your choice, keep rest all settings unchanged.
In additional settings, scroll down and set the initial database name
Set the security group as the database security group, that we made for this database earlier
Click on the Create database button
Our MySQL Database is successfully launched
Step 5:- Now let’s run our WordPress application from the public IP of our front end server, with following URL:- public_IP/wp-admin/setup-config.php
Click on Let’s go
Type the database name, username, password and the database host. Then, click on Submit.
Copy the endpoint of the Database server from our Database in the RDS menu to the database host column here, as our database for WordPress is created there.
Now, copy the below code, create a file named wp-config.php in our front end EC2 instance at the location of the document root of our apache web server ,paste the code there and then Save and Exit.
Now, Click on Run the Installation button .
Fill in the columns below with the required data and Click on Submit.
Click on Log In
Write the previously set Username and Password to login to the WordPress portal and Click on Log In
The WordPress application has run successfully, using front end as our EC2 Instance and back end as our RDS MySQL database server. Now, we can perform our desired tasks easily on this portal as per our requirement.