Hello everyone,
In this blog, we will be configuring WordPress over AWS and will use AWS RDS as a backend for WordPress
Tasks that we will be performing include:
- Create an AWS EC2 instance
- Configure the instance with Apache Webserver.
- Download PHP application name “WordPress”.
- Setup a MySQL server using AWS RDS service using Free Tier.
- Provide the endpoint/connection string to the WordPress application to make it work.
Before we get started with our tasks first let's understand :
What is 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.source
Create an EC2 instance
- To create an EC2 instance go to services and select EC2
- Now click on the Launch instance
- For this demo, we will use Red Hat Enterprise Linux 8
So click on the select
- Select t2 micro as instance type as it is free tier eligible
Now Click on Next:Configure instance Detail
Now click on Add storage
Now click on Add Tag
Now click on Click to add a Name tag
Give tag to your instance in value field, here I have given tag named WebApp
Now clink on Next: Configure Security Group
In type dropdown select All traffic so that firewall can allow all traffic though it is not good practice, we are using it for the demo.
Now click on Review and Launch
Now click on Launch and then select your key and click Launch instance
Now click on the instance id
Now you can see that EC2 instance is launched successfully
Create Database
- Again to service and search for RDS
Click on RDS
Now click on Create database
Now select Standard create and Select Engine MYSQL
Here I am using MYSQL version as MYSQL 5.7.31 and select template as Free tier
Now give the database name here I have given the name as WordPress and give the password to your account
Now give the public access to your database and click in Create Database
Now you can see our database is created
- Now run the EC2 instance that we created
Now update the repo by running the command dnf update -y
- Now install fedora rpm for further software
To install fedora rpm use command dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
- Now install wget software to download packages from internet
To download wget use the command yum install wget -y
- Now configure Apache webserver
To install an apache webserver use the command yum install httpd
- Start the Webserver
To start the webserver use command systemctl start httpd
and to check the status of web server use the command systemctl status httpd
- Now install PHP software
To install PHP use commands dnf install http://rpms.remirepo.net/enterprise/remi-release-8.rpm
, dnf module install php:remi-7.4
and dnf install php-mysqlnd
- Now install the Mysql database
To install MySQL use the command dnf install mysql -y
Connect RDS with an instance
To connect RDS with instance use command mysql -h <Database Endpoint> -u <username> -p
To check the Endpoint click on the database scroll down and you will find Endpoint.
Now Database has been connected with the instance
- Now download WordPress files
To download WordPress file use command wget http://wordpress.org/latest.tar.gz
and to unzip the file and copy in root directory use command tar -xvzf latest.tar.gz -C /var/www/html
Configure the WordPress
Go the root directory
cd /var/www/html/wordpress
edit the file
wp-config-sample.php
add your database name, username, password and hostname
Open WordPress in browser
To open WordPress in browser add your public ip of instance with the dir name that is PublicIp/wordpress
Now you will see the WordPress page
Now add credentials and start blogging
Thank you !!✨