Deploying WordPress on AWS using EKS and RDS with Terraform

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).


  1. To deploy a web app using EKS, we required the EKS cluster.
  2. To make the WordPress data and configuration persistent, we required persistent storage. Here we will use EFS(Elastic File Storage) for the persistent storage.
  3. WordPress docker image.
  4. 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.

connecting database

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.

That’s it for this Article. I hope you had learned how to launch the WordPress web app on the AWS-EKS cluster and using the RDS database services by AWS.

If you liked this article, please applaud it.

You can also follow me on Twitter at @cankush625 or find me on LinkedIn.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ankush Chavan

Ankush Chavan

Tech blogger, researcher and integrator