Deploying WordPress using Amazon RDS

Vineet Negi
4 min readApr 20, 2021

Task Description

  • Create an AWS EC2 instance.
  • Configure the instance with Apache Webserver.
  • Download PHP application named “WordPress”.
  • As WordPress stores data at the backend in MySQL Database server. Therefore, you need to setup a MySQL server using AWS RDS service using Free Tier.
  • Provide the endpoint/connection string to the WordPress application to make it work.

AMAZON RDS

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.

AMAZON EC2 Instance

Amazon Elastic Compute Cloud is a part of Amazon.com ‘s cloud-computing platform, Amazon Web Services, that allows users to rent virtual computers on which to run their own computer applications.

Let’s start this task by launching AWS RDS first why ?? because it takes some time to completely configure and we’ll be using that time the launch aws ec2 virtual computer.

  1. Setups to Launch AWS RDS
  • Click on Create database
  • For this setups I’ll be using MySQL DB.
  • I’m using just for testing this DB so I’ll be using Free tier which comes with the limited features but in case of Production type it provides high availability and consistency etc.. like features.
  • Untick the autoscaling which is automatically scale to storage if the specified threshold is exceed.
  • Providing Public access ( Not good practice) to connect DB from the outside world or different network.
  • db1 : database_name
  • untick Backup no need in testing phase in my case.

Click On Create Database

2. Launch AWS EC2 Instance

  • Let’s Launch instance ( virtual computer)
  • Using Amazon image
  • Allowing all traffic ( Not Good Practice) but in our case you can only allow the port u wanted to get expose to outside world
  • Select key ( or Create )
  • Launch the Instance

3. Installing WordPress Inside Ec2 instance

switch user to root to download and install the packages

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

Let’s install or untar the package or software

command : tar -xvf file_name

4. Install HTTPD and PHP to launch Wordpress

  1. HTTPD

2. PHP

amazon-linux-extras install php7.2

Due to compatibility issues good practice to use this php7.2

5. Enable, Start the Service AND Launch the Application

systemctl enable httpd --now
-->start and launch the service<--

Copy the Wordpress to the httpd location -> cp wordpress /var/www/html

Use Public_IP:80/wordpress to launch the webapplication

These all the details we’ll get from RDS data server

This this an issue this means unable to find wp-config.php file

cp wp-config-sample.php wp-config.php
---
then add the details
---
chown apache:apache /var/www/html (if not work disable selinux setenforce 0 )

TASK COMPLETED…..

--

--

Vineet Negi

★ Aspiring DevOps Engineer ★ Technical Volunteer @LinuxWorld ★ Technical Content Writer @Medium ★ ARTH Learner