Deploying WordPress-MySQL cluster (with HA) using AWS-RDS and Kubernetes-WordPress

Akshit Modi
4 min readJan 12, 2021

So, in this story we are going to cover how to use RDS service of amazon, launching mysql-wordpress cluster with High availability.

Step 1: Launching mysql Using amazon RDS services.

  • Go to RDS services, and click on create database.
  • Use MySQL as engine type, select version 5.7, it is more stable rather than other version.

Choose a database creation method: Standard Create
Engine Option: Mysql version 5.7
Templates: Free tier

  • Here we are going to use Free tier, but you can choose according to your requirement.
  • Give any name to database, and create username & password for this database.

DB name: rdsos
Username: admin

  • Because we have choose free tier, we can only use t2.micro as a database OS/instance, give storage size according to your requirement.
  • If you working in real environment, you can also create a standy instance, for disaster requirement strategy, try to launch in different AZ.

What is Standby Instance?

  • Your front end web/other application using this database as a backend.
  • For company most critical thing in real world is the database, so we can create a standby OS, if somehow our primary database goes down, we can use this database as a backup.
  • In amazon it will take real time backup of every transaction & session, so you don’t need to worry about this.

If you are using frontend application from different cloud or other places, then you have to allow public access to the real world, so your front end can connect to this.

Choose your security group.

You can also change this settings if you want, we are going with default seettings.

  • Now you can see your estimated budget cost, in our setup complete cluster comes under free tier so we don’t need to pay anything.

Now you can see your backend is ready to use in some minutes.

Read Replica

  • As you know we have to perform lots of analysis in our websites, for this we have to connect with our database many times according to use-case.
  • But it will give a extra traffic to our application and it will decrease performance of it.
  • So for our BI team, who are doing analysis and other admin part, we can simply create a read replica.
  • It is exact same replica of real OS, it is only for our admin/employee, coming with different user-pass combo with limited permissions.

Step 2: Launching WordPress as a frontend

  • Here we are going to use local Kubernetes cluster using minikube for launching our frontend side.
  • You can use this Blog if you don’t know how to setup Kubernetes in local system or you want to launch this in your AWS Ec2 instances.
  • URL: Configuring Kubernetes in different Platforms

There are 3 ways to launch WordPress in Ec2 instance.

  1. Launch Ec2 configure Kubernetes manually, launch WordPress container.
  2. Use WordPress AMI for launching Instance.
  3. Use Ec2 instance and setup WordPress on top of that.

We are going to use Local system, so let’s start…

Step 1: Launch WordPress container using Kubernetes, and expose it.

kubectl create deployment wp — image=wordpress — port=80
kubectl expose deployment wp — type=NodePort
kubectl get svc

Step 2: Open Browser and type URL for WordPress dashboard.

192.168.99.100:31963

  • You can able to see this screen now.
  • Choose your language and give details of your backend.
  • Give your database details.
  • after this you can able to see below screen, fill all the datils.
  • Now you can start using WordPress.
  • You can multiple replicas using Kubernetes for WordPress.
  • Our complete data will be stored in AWS HA cluster of RDS.
  • It will take care and manage complete things.
  • you can use this Username Pass for further Usage according to your requirements.

Thanks for watching.

Have a good day.

--

--