Deploying WordPress application on Kubernetes with AWS RDS using terraform

Deepak Jaiswal
4 min readSep 2, 2020

Task Description

I have written Infrastructure as code using Terraform, which automatically deploys the WordPress application. On AWS, I have used RDS service for the relational database for WordPress application. Then I deployed WordPress as a container on top of Minikube, the WordPress application is accessible to the public world.

Kubernetes is a portable, extensible, open-source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation

A Kubernetes cluster is a set of node machines for running containerized applications. If you’re running Kubernetes, you’re running a cluster. At a minimum, a cluster contains a control plane and one or more compute machines, or nodes. The control plane is responsible for maintaining the desired state of the cluster, such as which applications are running and which container images they use. Nodes actually run the applications and workloads.

AWS RDS 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.

Minikube is an open-source tool that helps to run Kubernetes on a local computer. Before using minikube we need to start it so here I wrote terraform code to start minikube on my Local Computer.

Let’s start with Project in detail

🔰Problem Description:-

🔷 Write an Infrastructure as code using Terraform, which automatically deploy the WordPress application

🔷 On AWS, use RDS service for the relational database for WordPress application.

🔷 Deploy WordPress as a container either on top of Minikube or EKS or Fargate service on AWS.

🔷 The WordPress application should be accessible from the public world if deployed on AWS or through workstation if deployed on Minikube.

notepad wp.tf

notepad dbsql.tf

notepad main.tf

RDS will be created on top of AWS.

To deploy complete Infrastructure-

In Order to Build the Complete Infrastructure, At first, we have to initialize Terraform -

terraform init

We can set-up the Complete Infrastructure in just a single click.

terraform apply — auto-approve

To check the IP

minikube service list

To check if the deployment is running fine or not-

kubectl get all

Using the IP address launch the WordPress Application and enter the details of RDS.

Task has been completed.

Happy learning😊

--

--