WordPress is a content management system generally used to host content like blogs on the internet.
WordPress requires the database to store the data. So, here we will use the database service provided by AWS that is the RDS(Relational Database Service).
To make this application more scalable, we will deploy this application on the Kubernetes. AWS provides Kubernetes as a service named as EKS(Elastic Kubernetes Services).
- To deploy a web app using EKS, we required the EKS cluster.
- To make the WordPress data and configuration persistent, we required persistent storage. Here we will use EFS(Elastic File Storage) for the persistent storage.
- WordPress docker image.
- Relational database RDS.
Creating an EKS cluster and EFS storage:
For creating EKS cluster and EFS storage refer to this article where I’d already shown how to configure them.
So, up till now, we had created an EKS cluster and created and configured an EFS storage to provide persistent storage to WordPress.
Creating a Relational Database for WordPress:
We will use Terraform(Infrastructure As Code) for creating and deploying WordPress and RDS.
The aws_db_instance module is used to create an RDS database. Here we are using MySQL version 5.6.
Finally, we are deploying WordPress on the EKS.
Running Terraform code:
Use the following commands to run the Terraform code.
$ terraform init
$ terraform apply
Finally, the WordPress app is deployed in the EKS, and the RDS database is created.
Accessing the WordPress App:
To access the WordPress app we need to know the URL of the WordPress app. As we are using Kubernetes(EKS), we have to get the URL of the service.
Run the following command to get the URL of the WordPress app.
$ kubectl get all
Get the EXTERNAL-IP and open it in the browser.
As we are getting the WordPress installation screen, we had deployed WordPress correctly. Now, we have to configure and install WordPress and connect the database to it.
After database connection is done, we just have to install WordPress. And after that are ready to create and publish our content to the public world.
Finally, we had launched our WordPress application of the EKS using RDS. This application is so scalable that we can scale it up and down according to the requirements and traffic to the app.