MULTI TIER ARCHITECTURE IN AWS

Rishabh Jain
7 min readJan 15, 2021

Bonjour! technical people today I am going to show you that how to launch a full fledged Multi Tier Architecture all on the top of the AWS Cloud. It is wonderful setup in which we are going to host a WordPress site in the Linux Server and making a database from the RDS service of the Cloud. The whole Multi tier architecture is made on the top of AWS Cloud.

What is Multi Tier Architecture ?

It is a client–server architecture in which presentation, application processing and data management functions are physically separated. The most widespread use of multitier architecture is the three-tier architecture. A layer is a logical structuring mechanism for the elements that make up the software solution, while a tier is a physical structuring mechanism for the system infrastructure. It is also known as Multi Layered or n-layered Architecture.

This was the basic and required description for understanding the setup. Now we can move ahead for creating the whole proposed setup.

As in this WordPress site is hosted, so here is the GitHub Repository for its code.

Let us begin now !!

Firstly one has to launch an EC2 instance in the AWS Cloud. For the one who is very new to the AWS can take the reference from the blog given below.

1. WEB SERVER

Once the Instance is created we will be moving to create the Web Server on the top of the EC2 instance. For this one needs to install Httpd software in the system as shown below.

Command for HTTPD Installation:

yum install httpd

Once it is installed we need to move the WordPress folder to the /var/www/html/ folder. To do the same follow the steps shown below.

  1. Extract the File in your system.

2. Transfer the Extracted folder to the instance launched by the WinScp software.

3. Now copy the folder in the /var/www/html/ folder.

4. The folder will be looking as the same shown below.

5. Now start the Httpd server by the command shown below.

systemctl start httpd and check its status through the command systemctl status httpd as shown below.

You can view it in the Browser by putting the IP address of Instance and then/ wordpress as shown below.

Now once it is done we can move to create a RDS service in the AWS Cloud.

2. RDS (DATABASE)

There are some pre-requisites for the connection of database.

  1. MySql
  2. Php-mysqlnd
  3. php version 7.4

To Install MySql use the command shown below.

To install php-mysqlnd use the command shown below.

To Install php 7.4 use the commands shown below.

  1. Setup EPEL Repository

2. Setup REMI Repository

3. Installing PHP

4. Installing PHP module 7.4

5. Checking the Version of PHP

Now let us make the RDS service in AWS.

Search for the RDS service in the AWS console and once you find it you wil be landed to this page. Click on create Database.

Choose for MySQL as shown below.

Set the username and password for the database as shown below. It will help in connecting to the Instance.

Set the Public Accessibility to yes as to get the connectivity to the Instance i future as shown below.

Now click on Create Database button as shown below.

After sometime a DB Instance will be created as shown below.

Now click on the database-1 as shown below.

You will be landed to a page shown below.

Now copy the Endpoint from the page as shown below.

Now in your Instance connect to your database by the command shown below.

Once you put your set password here you will get connected to the database and will be dropped to this page shown below.

Now here make a database with any name as shown below.

COMMAND:

create database <DB Name>;

Now one can check by the command shown below.

COMMAND:

show databases;

To come out of the database use exit as shown below.

Once done with that it means all is working fine and your RDS service is working fine and ready to connect.

3. CONNECTING RDS WITH WORDPRESS

Now for connecting WordPress with RDS first go to the /var/www/html/ folder which contains WordPress folder as shown below.

Now Enter Into the folder by the cd command as shown below.

After entering into the folder just rename the wp-config-sample.php file with wp-config.php file by the mv command as shown below.

Now open the file by vi editor as shown below.

In the file do the following changes as shown below. (Press I and you will be able to Edit and for saving Press Esc and then :wq other than :qa!)

Now just stop the selinux by the command setenforce 0.

and restart the Httpd server by the command systemctl restart httpd

Now just go to the browser and visit to the webserver again as shown below. You will be viewing the page shown below and if seems to be your WordPress is connected to the Database at RDS in AWS.

Now just fill out the Information and Click on Install WordPress as shown below.

After clicking on it you will be landing to the Login Page as shown below.

Fill the Username and Password and you will be landing to the Dashboard Of WordPress as shown below.

Your Multi Tier Architecture is now up and ready to work.

HOPE YOU LEARNED AND ENJOYED A LOT. THANKS A LOT!!

--

--

Rishabh Jain

I am a tech enthusiast, researcher and an integration seeker. I love to explore and learn about the right technology and right concepts from its foundation.