Integrating AWS RDS with WordPress Application on AWS Cloud

Amazon Relational Database Service (Amazon RDS) is a web service that makes it easier to set up, operate, and scale a relational database in the AWS Cloud. It provides cost-efficient, resizable capacity for an industry-standard relational database and manages common database administration tasks.

DB instances

The basic building block of Amazon RDS is the DB instance. A DB instance is an isolated database environment in the AWS Cloud. Your DB instance can contain multiple user-created databases. You can access your DB instance by using the same tools and applications that you use with a standalone database instance. You can create and modify a DB instance by using the AWS Command Line Interface, the Amazon RDS API, or the AWS Management Console.

Each DB instance runs a DB engine. Amazon RDS currently supports MySQL, MariaDB, PostgreSQL, Oracle, and Microsoft SQL Server DB engines. Each DB engine has its own supported features, and each version of a DB engine may include specific features. Additionally, each DB engine has a set of parameters in a DB parameter group that controls the behavior of the databases that it manages.

The computation and memory capacity of a DB instance is determined by its DB instance class. You can select the DB instance that best meets your needs. If your needs change over time, you can change DB instances.

DB instance storage comes in three types: Magnetic, General Purpose (SSD), and Provisioned IOPS (PIOPS). They differ in performance characteristics and price, allowing you to tailor your storage performance and cost to the needs of your database. Each DB instance has minimum and maximum storage requirements depending on the storage type and the database engine it supports. It’s important to have sufficient storage so that your databases have room to grow. Also, sufficient storage makes sure that features for the DB engine have room to write content or log entries.

You can run a DB instance on a virtual private cloud (VPC) using the Amazon Virtual Private Cloud (Amazon VPC) service. When you use a VPC, you have control over your virtual networking environment. You can choose your own IP address range, create subnets, and configure routing and access control lists. The basic functionality of Amazon RDS is the same whether it’s running in a VPC or not. Amazon RDS manages backups, software patching, automatic failure detection, and recovery. There’s no additional cost to run your DB instance in a VPC.

WordPress

WordPress is a free and open-source content management system (CMS) 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. WordPress was originally created as a blog-publishing system but has evolved to support other web content types including more traditional mailing lists and forums, media galleries, membership sites, learning management systems (LMS), and online stores. WordPress is used by more than 40.5% of the top 10 million websites as of March 2021, WordPress is one of the most popular content management system solutions in use.WordPress has also been used for other application domains, such as pervasive display systems (PDS).

Step1: Launch an EC2 instance

Step2: Launching a Mysql Database using RDS service

Here, I am using my pre-created Security Group which allows all inbound connections so that we can connect to the database from anywhere.

I have used MySQL version 5.7.30 which is compatible with WordPress latest version

Step 3: Installing the WordPress and httpd server on the EC2 instance

After Login to the instance run following Commands:

$ yum install httpd php -y

Download WordPress Software using :

$ curl https://wordpress.org/latest.tar.gz --output wordpress.tar.gz
  1. Untar/unzip the downloaded WordPress tar file
$ tar xf wordpress.tar.gz

2. Go to WordPress directory and copy all the content of that directory to the /var/www/html directory

$ cd wordpress
$ cp -r * /var/www/html/
$ systemctl start httpd

$ systemctl status httpd

Now Start the httpd services :

$ systemctl start httpd
$ systemctl status httpd

Step 4: Go to the EC2 instance and copy Public IP to access the WordPress server

Then you will land to the above page where you have to provide all the required Database credientials and now your WordPress setup is done successfully.