Deploying wordpress application with AWS RDS as backend database

Deepanshu Yadav
6 min readJul 19, 2021

Lets first see what we are going to do

🔅 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, setup a MySQL server using AWS RDS service using Free Tier.
🔅 Provide the endpoint/connection string to the
WordPress application to make it work.

Lets start with making an aws instance

Go to your AWS console and launch an instance with AMI amazon linux2 and t2.micro or choose according to you the ram and cpu. Below are some SS for launching👇

Now lets configure this instance with webserver and some more required things like mysql, php, etc as these are required because wp is a php application.👲

Login with root using putty or browser based client of AWS

Now install httpd, vim and mysql

Now lets install php also here as we require it.

🎇This is the way to do in aws ami, by enabling some extra packages as php is not present in the yum of amazon linux2.🎇

🎇Now lets install wordpress. Go to the link below and copy the tar file link and use wget command to download it in instance as shown below🎇

✔Now extract it in /var/www/html folder✔

✔Now go to browser and put ip/wordpress and you will get the below page as output✔

🔰So, wordpress is successfully setup.Now lets launch the RDS database on AWS and then will connect the two also.🔰

👉Go to rds and then on databases in the left and click on create database.

Now follow the below screenshots to configure the database

Create the database now and you will see this in your dashboard of databases

✔Go inside your database and copy the endpoint URL and now lets try to connect to it through our CLI of instance.

✔write this command to connect

👉you will see it is not connecting. this is due to the security group. so, go to the security group of this database and change it

👉Now again try to connect and see now we can. Also the database ourfirstdb is also present that we created in the configuration part.

👲So, now we can connect to our database, now lets connect wordpress to it. just go to the same page and give the required information.👲

🔰Now see there is some error come up. wp actually behind the scene creates one more file called wp-config.php which is exactly the wp-config-sample.php and it just have the credentials present.🔰

🍤So, we need wp-config.php which wp not able to make. therefore let’s make it manually. either copy everything from here and make a file in html folder with this name and paste everyhing in it OR copy the file directly from there and write your credentials and save. Both is same, i have shown the second method in the below screenshots.🍤

✨Now click on run installation and you will get the below page. here you can set your username and password and enter and start working in the wordpress.✨

click on run installation and we are done !!

Everything we make here would be stored in AWS RDS !!

You can choose AMI and other things acaccording to your use, I have choosen free tier to show this.

Thanks for your time! DM me on linkedin for any related queries😊

--

--