DEV Community

Cover image for WordPress configuration over AWS with Amazon RDS
Nitesh Thapliyal
Nitesh Thapliyal

Posted on

WordPress configuration over AWS with Amazon RDS

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

Alt Text

Create an EC2 instance

  • To create an EC2 instance go to services and select EC2

Alt Text

  • Now click on the Launch instance

Alt Text

  • For this demo, we will use Red Hat Enterprise Linux 8

So click on the select

Alt Text

  • Select t2 micro as instance type as it is free tier eligible

Alt Text

Now Click on Next:Configure instance Detail

Alt Text

Now click on Add storage

Alt Text

Now click on Add Tag

Alt Text

Now click on Click to add a Name tag

Alt Text
Give tag to your instance in value field, here I have given tag named WebApp

Now clink on Next: Configure Security Group

Alt Text

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

Alt Text

Now click on Launch and then select your key and click Launch instance

Now click on the instance id

Alt Text

Now you can see that EC2 instance is launched successfully

Alt Text

Create Database

  • Again to service and search for RDS

Click on RDS

Alt Text

Now click on Create database

Alt Text

Now select Standard create and Select Engine MYSQL

Alt Text

Here I am using MYSQL version as MYSQL 5.7.31 and select template as Free tier

Alt Text

Now give the database name here I have given the name as WordPress and give the password to your account

Alt Text

Now give the public access to your database and click in Create Database

Now you can see our database is created

Alt Text

  • Now run the EC2 instance that we created

Now update the repo by running the command dnf update -y

Alt Text

  • 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

Alt Text

  • 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

Alt Text

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

Alt Text

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

Alt Text

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

Alt Text

Now add credentials and start blogging

Alt Text

Thank you !!✨

Top comments (0)