Integrating WordPress with AWS RDS On AWS Cloud

Manav Misra
4 min readJul 13, 2021

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.

What Is WordPress?

WordPress is open-source software, which means anyone can study its code and write their apps (plugins) and templates (themes) for it.

Task Description

🔅 Create an AWS EC2 instance
🔅 Configure the instance with Apache Webserver.
🔅 Download PHP application name “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.

Step 1:

1. Launch an EC2 instance For Deploying WordPress using AWS dashboard or CLI or terraform.

2. Connect to EC2 Instance using Putty and install necessary packages.

3. Install httpd using command :

yum install httpd -y

4. Install MySQL using command :

yum install mysql -y

5.

Since WordPress uses the latest version of PHP i.e PHP-7.4. Install it by the following commands in the AWS instance :

  1. sudo yum install amazon-linux-extras -y
  2. amazon-linux-extras enable php7.4

6. Download WordPress code from the Internet and Extract it into /var/www/html folder

wget https://wordpress.org/latest.tar.gztar -xvzf latest.tar.gz -C /var/www/html

Unzip the file using

tar -xf latest.tar.gz

Step 2: Create RDS database For WordPress

  • Open Amazon RDS and click on Create Database
  • Select MySQL as database type
  • In the Templates section, choose the Free tier.
  • DB instance identifierdefault
  • Master usernameadmin
  • Master password — Choose a password.
  • Confirm password — Confirm the password
  • Availiability Zone — us-east-1
  • Initial Database Name — database-2

Select RDS service under Database Section

Click on Create Database

Select MySQL

Database Created Successfully

STEP 3: Connecting to database and connecting to WordPress

1. Check connection to database using

mysql -h endpoint url -u admin -p

2. Configure The wp-conf.php file by providing Database Name, User Name, Password, Endpoint Url

3. Connect to WordPress using

public_ip/wordpress
  • Provide Databse Name,UserName,Password,Endpoint Url

11. Finally connection of WordPress with mysql is established

Still, have a query, feel free to ask in the comment box.

Thank you !.. if you like this article then please share this post with your fellow tech enthusiast.

You can also follow me on my linked in profile by clicking on following link.

https://www.linkedin.com/in/manavmisra2/

--

--