AWS EC2 integration with Free Tier RDS

Neeraj Singh Negi
3 min readJan 21, 2021

Multi-Tier Application WordPress with Mysql.

  1. Create an AWS EC2 instance
  2. Configure the instance with Apache Webserver.
  3. Download PHP application name “WordPress”.
  4. WordPress stores data at the backend in the MySQL Database Server.
  5. Therefore, you need to set up a MySQL server using AWS RDS service using Free Tier.
  6. Provide the endpoint/connection string to the WordPress application to make it work.

Launch EC2 instance.

Download WordPress software.

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

Extract tar file.

tar -xzvf latest.tar.gz

Install Mysql client program and the Web server program.

yum install mysql httpd

Enable the webserver services for permanent.

systemctl enable httpd — now

Open the WordPress web app and you might see this error.

Your server is running PHP version 5.4.16 but WordPress 5.6 requires at least 5.6.20.

Then, enable the php7.4 version in your EC2 instance.

amazon-linux-extras | grep php
amazon-linux-extras enable php7.4

Now, clean your yum and install the dependencies program.

yum install php-cli php-pdo php-fpm php-json php-mysqlnd

Now, the time comes to launch RDS (Relational Database Service).

Copy your wp-config-sample.php file to wp-config.php and edit it with new information (database name, user name, database password, and the host).

The host is your RDS server. So copy the Endpoint of the RDS and paste it into your file.

cp wp-config-sample.php wp-config.phpvim wp-config.php

Connect with RDS via MySQL client if there is a need.

mysql -h wordpress-db.c6yqauexldov.ap-south-1.rds.amazonaws.com -u admin -p

Output

--

--

Neeraj Singh Negi

AWS | Openstack | GCP | Ansible | Redhat 8 Linux | Docker | Jenkins | Kubernetes | Hadoop | Python | Machine Learning