Integrating Amazon RDS with WordPress

Prakash Agarwal
Towards AWS
Published in
5 min readMay 31, 2021

--

We will connect the WordPress site with AWS RDS, launching via AWS EC2.

Task Descriptionđź“„

đź”… Create an AWS EC2 instance

đź”… Configure the instance with Apache Webserver.

🔅 Download PHP application name “WordPress”.

đź”… WordPress stores data at the backend in the MySQL Database Server. Therefore, you need to set up a MySQL server using AWS RDS service using Free Tier.

đź”… Provide the endpoint/connection string to the WordPress application to make it work.

Let’s First understand:

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.

Let’s Begin with the Task of launching an EC2 instance:

We will launch an instance as a standard process with Amazon Linux 2 AMI.

Now, We will connect with the CLI Terminal and Configure it with Apache Webserver, WordPress, and MySQL

# sudo su -
# yum install httpd -y
# systemctl start httpd
# systemctl enable httpd (To start it permanently)

# amazon-linux-extras install -y php7.2

With this cmd You can install PHP 7.2 then you will have to download the WordPress files and unzip them as follows:

# wget http://wordpress.org/latest.tar.gz# tar -xvzf latest.tar.gz (After download the “TAR” file “UNTAR” it)

Now Copy All the Files in the folder of Apache Web Server, So that It can access the files. (/var/www/html)

cp -rf wordpress/* /var/www/html

Install MySQL as same with cmd:

yum install mysql -y

Now, We will set up the AWS RDS instance while creating a database in it too.

Fill all the fields as follows:

In Public Access, Give No as It will be in the same VPC as EC2 and So It should connect internally.

Now, We will initiate a database named mydb to connect with the site

Then click on Create and It will create an SQL Instance in RDS.

Now, We will connect RDS with WordPress:

Go to Configured EC2 instance and Copy the Public IP Address.

http://<public_ip>/

Click on Let’s Go:

Fill in Your Details, As Username, Password, and Endpoints of RDS Instance in Host. and Submit.

It will Open the WordPress Configuration File, Which You will have to Copy in Your instance file. You will see the instruction on Page.

We will create a new wp-config.php file, as our system couldn’t create one and copy-paste the configuration data.

After Saving the File, Go to Browser Page and Click on Run The Installation.

The next Page will ask you for Your WordPress account details:

Fill in Your Details and Click on install WordPress.

One Confirmation Page will display:

After that, log in with Your Account Credentials that you set up for WordPress Account and One Dash-Board Page will display like:

To display Your Site Just Go to Home and Visit Your Site.

Finally, Our Task is Completed Successfully!!!

Now You can modify your site as you want and Store Data in AWS RDS with MySQL successfully!!!!

I Hope from these Article you get Idea to Integrate RDS MySQL with WordPress! If You have any Doubt or Suggestion, You can connect with me:

Thank You!!! Keep Learning!!!

--

--

Technical Writer | Content Creator | Storyteller | Engineer | Investor