Connect RDS with WordPress

Shubham Jangid
5 min readJul 1, 2021

--

đź”… 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.

Purpose:-

To learn multiple technologies and integrate with each other, we achieve something great to enhance our knowledge and skills, we tried to setup our all the things over the cloud so all can access globally.

What is RDS:-

Amazon Relational Database Service is a distributed relational database service by Amazon Web Services. It is a web service running “in the cloud” designed to simplify the setup, operation, and scaling of a relational database for use in applications.

What is WordPress:-

WordPress is a free and open-source content management system written in PHP and paired with a MySQL or MariaDB database. Features include a plugin architecture and a template system, referred to within WordPress as Themes.

👉 Pre requisites For this setup is:-

  1. You must have Account on AWS
  2. Basic knowledge of Linux OS
  3. Basic Knowledge of MySQL database

👨‍💻 Let’s start working on the setup:-

Step 1: Search for RDS and select

Step 2: Now Click on create Database

Step 3: Select MySQL as database

Step 4: Select database instance as free tier

Step 5: Set authentications for the database

Step 6: Give Storage to the database

Step 7: Select VPC for Database instance

Step 8: Select authentication type

Step 9: Now your Database is ready to create

Step 10: Now you need a instance for use this database so go for EC2 services

Step 11: Launch a new instance

Step 12: Select AMI as Amazon Linux 2 AMI

Step 13: Select instance type as t2.micro(free tier)

Step 14: Select VPC and subnet

Step 15: Add storage for instance (in this we go for default size)

Step 16: Add tags as “WordPress”

Step 17: Allow Network traffic for instance

Step 18: Now launch instance

Step 19: Login inside the instance

Step 20: Install apache server(httpd) and MySQL

Step 21: Download WordPress in the instance
cd /var/www/html/
wget https://wordpress.org/latest.tar.gz

Step 22: Enable php7.4
amazon-linux-extras enable php7.4

Amazon Linux 2 instance has a inbuilt feature of php7.4 so we have to just enable it.

Step 23: Clean metadata for the instance and install PHP
Here we need to clean meta data of the instance because some unwanted caches are created in the instances. Install PHP versions which support all PHP types like JSON, MySQL, etc.

yum clean metadata; yum install php-cli php-pdo php-fpm php-json php-mysqlnd

Step 24: Start Apache server(httpd) services
systemctl start httpd

Step 25: Login inside the MySQL
mysql -h <RDS domain name> -u <username> -p

Step 26: Make changes in configuration MySQL

Step 27: Now lets try our setup

Step 28: Login inside WordPress (Give authentication)

Step 29: Now you can see dashboard of WordPress

Step 30: Create our first blog

Step 31: Output of our blog

All the data are stored in the RDS.

Thank you

--

--

No responses yet