Deploying WordPress using Amazon RDS

Task Description

  • Configure the instance with Apache Webserver.
  • Download PHP application named “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.

What is Amazon RDS?

Amazon RDS is available on several database instance types — optimized for memory, performance or I/O — and provides you with six familiar database engines to choose from, including Amazon Aurora, PostgreSQL, MySQL, MariaDB, Oracle Database, and SQL Server. You can use the AWS Database Migration Service to easily migrate or replicate your existing databases to Amazon RDS.

What is WordPress?

What is MySQL?

Let’s jump into the task:

  • Services -> Database -> RDS.
  • Click on Create database.
  • Select MySQL
  • Select latest version of MySQL. Next select free tier so that we don’t get charged.
  • Name your database and set the user name and password for the database.
  • Leave rest of settings as default and in the Public access we need to select yes or else we won’t be able to connect to WordPress.
  • We have to choose the security group if we have already created any, otherwise we can create a new one.
  • Now, click on create database.
  • It will take few minutes to launch the database. So, wait for some time.

Step 2: Launch EC2 instance and configure WordPress.

  • Create EC2 instance either by GUI or CLI
  • Click on connect, to connect to the EC2 instance.
  • Run the following command:

$ sudo su - : to become root user so that you can run all the command with root privilege.

  • To setup the WordPress we need to install some software.

$ yum install httpd -y : to install apache webserver

$ yum install mysql -y : to install mysql

  • Run the following command:

$ amazon-linux-extras install php7.4 : to get command to install PHP

  • Now go to the official site of WordPress https://wordpress.org/download/ and copy the download link.
  • Go to the “cd /var/www/html/” folder.
  • Run the command to download the wordpress software.

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

  • Use the command to unzip the Wordpress software.

$ tar -xf latest.tar.gz

  • Enable the httpd service
  • Enter your public IP of EC2 instance on browser followed by the wordpress folder “publicIP/worpress”.

Step 3 : Check the RDS MySQL database connectivity.

  • Copy the database endpoint.
  • Run the below command to connect your database. Enter the correct endpoint, username and password in this command.
  • We can run MySQL commands to check database and tables.
  • We can open the WordPress server in the browser now.
  • As soon as we hit we get the following error which depicts that our work of configuring is not done yet.
  • Login to and go to the wordpress folder and copy wp-config-sample.php to wp-config.php
  • now open this wp-config.php file and enter the database name, user , password and endpoint of RDS mysql database.
  • Restart httpd and mysql service.
  • Now again go to the browser and refresh the page and enter the details and click on install wordpress.
  • Login to WordPress site.
  • Click on “view your site”.
  • Now click on Edit to edit your wordpress site accordingly.
  • Now again login to your Mysql database to verify if the data is being stored or not.
  • Go to the WordPress database (sqldb in my case) and see the tables.
  • If we print the wp_posts, we’ll to able to see the content.
  • If we print the data of wp_comments, we’ll see the comments.

Thus we also verified that RDS MySQL and WordPress are working good together.

ARTH | IIEC Rise | GoogleCloudReady Facilitator | Proficient Photographer | Quantum Computing Enthusiast