💠Configuring a Database Server using AWS RDS and launching a WordPress application on its Front End server on AWS EC2💠

🔰 What is WordPress?

At its core, WordPress is the simplest, most popular way to create your own website or blog. In fact, WordPress powers over 40.0% of all the websites on the Internet. Yes — more than one in four websites that you visit are likely powered by 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 RDS?

Amazon Relational Database Service (Amazon RDS) makes it easy to set up, operate, and scale a relational database in the cloud. It provides cost-efficient and resizable capacity while automating time-consuming administration tasks such as hardware provisioning, database setup, patching and backups. It frees you to focus on your applications so you can give them the fast performance, high availability, security and compatibility they need.

Amazon RDS is available on several database instance types — optimized for memory, performance or I/O — and provides you with six familiar database engines to choose from, including Amazon Aurora, PostgreSQL, MySQL, MariaDB, Oracle Database, and SQL Server. You can use the AWS Database Migration Service to easily migrate or replicate your existing databases to Amazon RDS.

🔰 I am going to perform task and the steps which I am goin to perform in the task are as follows.

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

Now let’s move towards implementation of task…

💠 Launch one EC2 instance.

I am using amazon Linux 2 image.

  • Launched ec2-instance named
  • While launching ec2 instance using above image I have created on security group with following inbound rules.

i.e created security group named for_ec2_with_wordpress

  • Now I am creating one more security group which I will use while creating RDS instance.

As the data is very important we only want the ec2 instance to connect to our database server. Therefore, we add a custom SG which we created up WPEC2 for the RDS server.

Now cick on create security group button your security group will be vcreated.

💠 Let’s configure the apache webserver on launched ec2-instance and the download and install the php application i.e “wordpress”

  • Install httpd, php and mysql on ec2 instance
  • Edit httpd configuration file

To go inside configuration file of httpd use following command

vim /etc/httpd/conf/httpd.conf

and then do following changes as shown in picture.

  • Now start the httpd services.

yes.. now apache webserver has configured.

  • Now install some extras for php using amazon extras
  • What is Amazon Linux extras?

Extras is a mechanism in Amazon Linux 2 to enable the consumption of new versions of application software on a stable operating system that is supported until June 30, 2023. Extras help alleviate the compromise between the stability of the OS and freshness of available software. For example, now you can install newer versions of MariaDB on a stable operating system supported for five years. Examples of extras include Ansible 2.4.2, memcached 1.5, nginx 1.12, Postgresql 9.6, MariaDB 10.2, Go 1.9, Redis 4.0, R 3.4, Rust 1.22.1.

Now let’s install webserver

  • download the wordpress

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

  • Extract WordPress
  • Now moving all the files from wordpress folder to root directory of httpd
  • Give particular permission to all the files
  1. chmod -R 755 *
  2. chown -R apache:apache *
  • now again restart the services of httpd

systemctl restart httpd

💠 As wordpress stores data at the backend in MySQL Database server. Therefore, we need to setup a MySQL server using AWS RDS service using Free Tier.

  • Go to service of aws select RDS

I am going to use Mysql data base from RDS

  • Select mysql
  • Select version of mysql -(in my case i am using 5.7.31)
  • Here I am going to use free tier
  • DB instance size
  • Name for DB Instance:
  • Credentials :
  • Storage: Allocated storage is 20gb but as per requirement it autosacle the storage.
  • Do not give the public access to the RDS instance, So only the EC2 can connect the DataBase server. so do the same select option no
  • DB instance class : Actually by default free tier provide only t2.micro but if we go for paid one we can get more options there.(ans I am using free tier so I have chose db.t2.micro)
  • Choose the existing security group which we created for RDS i.e SG_for_RDS

Now we have done almost all the required things so that now click on create database button and create database Instance.

And DataBase created 🤩 We can check now..

💠 Now let’s login to the database server from ec2-instance which we have launched .

Command to get login : mysql -h <endpoint> -u <user_name> -p

then enter your database password

Note- You can get the endpoint in the connectivity and security menu of RDS.

  • Let’s create one database using mysql query

CREATE DATABASE <Database_name>;

now database with name wp_on_aws has created successfuly we can see that database using command : show databases;

  • Now I went inside created database .

Command to use that created database : use <database_name>;

and still I haven’t created any table here .

Now both things are ready the EC2 with httpd service started and the RDS instance for DataBase.

💠 Now let’s access install wordpress from browser using public IP of launched Instance.

use command : — http://<public_ip>/wordpress

After hitting above url you will be landed to following page of wordpress application.

  • click on continue
  • Now let’s go and provide database name and endpoin and required information as shown below.
  • Now everything is ready now run the installation

Note: If any error comes after running the installation restart the httpd service and give the 755 permission to the wp-config.php file and also make apache the owner of wp-config.php i.e chown -R apache:apache wp-config.php

  • Now move ahead by clicking on submit button.
  • After this we will be landed to page shown below

Again let’s move ahead by clicking on Install Wordpress

And finally we have Installed wordpress from ec2-instance wich is uses mysql database from RDS 🤩

💠 Now you can use this wordpress application by doing sign in / log in

  • note- Use password which we get while Installing wordpress

Let’s log in to use wordpress

And here you can see task completed and now you can write blogs !! 🤩

Thanks for Reading !! 🙌🏻

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store