Integration of AWS EC2 with WordPress using AWS RDS !!!

Rishabh Arya
6 min readAug 3, 2023

โœ”๏ธ Task Description ๐Ÿ“„

๐Ÿ”… Create an AWS EC2 instance.

๐Ÿ”… Configure the instance with Apache Web Server.

๐Ÿ”… Download PHP application name โ€œWordPressโ€.

๐Ÿ”… As WordPress stores data at the back-end MySQL Database server. Therefore, you need to set up a MySQL server using the AWS RDS service using Free Tier.

๐Ÿ”… Provide the endpoint/connection string to the WordPress application to make it work.

This is an important article on WordPress and Amazon RDS. In this article, I have configured the instance with Apache Webserver on Amazon Linux O.S on AWS cloud and also configured MySQL server using AWS RDS service using Free Tier.

Letโ€™s Dive in !!!

What is WordPress?

At its core, WordPress is a free, open-source website creation platform. WordPress is a content management system (CMS) written in PHP that uses a MySQL database. WordPress is the easiest and most powerful blogging and website builder. A content management system is basically a tool that makes it easy to manage important aspects of your website โ€” like content โ€” without needing to know anything about programming.WordPress is the simplest, most popular way to create your own website or blog. In fact, WordPress powers over 40% of all the websites on the Internet. Yes โ€” more than one in four websites that you visit are likely powered by WordPress.

On a slightly more technical level, WordPress is an open-source content management system licensed under GPLv2, which means that anyone can use or modify the WordPress software for free.

What is Amazon RDS?

The Amazon Relational Database Service (Amazon RDS) is a managed SQL database service provided by Amazon Web Services that makes it easier 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.

Amazon RDS supports an array of database engines to store and organize data and helps with database management tasks, such as Migration, backup, recovery, and patching.

So, here we start with our task:-

Step 1 โ€” First, we need to launch an ec2 instance on AWS.

Step 2 โ€” Now login to the EC2 instance.

To configure WordPress, we need to configure Apache WebServer.

yum install httpd -y

Step 3 โ€” Now install MYSQL.

Step 4 โ€” Now install php7.2

amazon-linux-extras install php7.2

Step 5 โ€” Now Download WordPress

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

Step 6 โ€” Now Extract the package.

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

Letโ€™s Check!!!

Step 7 โ€” Setting up the /etc/httpd/conf/ httpd.conf file

Making AllowOverride None to AllowOverride All

Step 8 โ€” Setting Up the Amazon RDS instance.

Setting Up name and password for the instance to access

Step 9โ€” Now connect to the database using following command.

mysql -h <endpoints of RDS INSTANCE> -u admin -p

Step 10โ€” exiting from MySQL

Step 11 โ€” Starting Httpd using CLI

Letโ€™s Check!!!

Use the following command to open WordPress

<IP>/wordpress

After clicking on Letโ€™s go it will direct you to the below page.

After clicking on submit you will be directed towards below page.

Copy the content from here and paste it into the wp-config.php file.

Step 12 โ€” Copying content from WordPress to wp-config.php file

cat command allows us to create single or multiple files, view contain the file, concatenate files, and redirect output in terminal or files.

cat > /var/www/html/wordpress/wp-config.php
cat /var/www/html/wordpress/wp-config.php

here cat command is used to see the content which is copy-pasted in the above command.

Now click on Run the installation as shown in the below screenshot

You will be directed to the below page where you will be allowed to put the name and password.

Step 13 โ€” Click on Install WordPress and then you will be directed towards the below page.

Step 14โ€” Now log in using credentials entered before.

So our WordPress Application is Successfully Deployed.

--

--

Rishabh Arya

I am an active learner who likes to challenge every problem with a can-do mindset in order to make any idea a reality.