Web hosting on Aws cloud using Aws Eks

Amazon Elastic Kubernetes Service (Amazon EKS) is a fully managed Kubernetes service. Customers such as Intel, Snap, Intuit, GoDaddy, and Autodesk trust EKS to run their most sensitive and mission critical applications because of its security, reliability, and scalability.

EKS is deeply integrated with services such as Amazon CloudWatch, Auto Scaling Groups, AWS Identity and Access Management (IAM), and Amazon Virtual Private Cloud (VPC), providing you a seamless experience to monitor, scale, and load-balance your applications.

EKS integrates with AWS App Mesh and provides a Kubernetes native experience to consume service mesh features and bring rich observability, traffic controls and security features to applications.

Additionally, EKS provides a scalable and highly-available control plane that runs across multiple availability zones to eliminate a single point of failure.


Kubernetes also known as K8s, it is a system for automating deployment, scaling and management of containerized applications , in short it is a container Orchestration tool.

Wordpress is a common Content Management System for building websites and blogs. Scaling Wordpress can be difficult, especially in the cloud due to the shared file system requirement for uploads, plugins, and themes. AWS publishes a document with best practices for running highly scalable Wordpress installations on AWS. This blog follows Wordpress’ deployment for putting the entire Wordpress codebase in an Elastic File System (EFS) mount.

The principles of this document can be applied to any Kubernetes deployment on AWS.

here we are going to learn about aws EKS service and its usecases. In this post, we will walk through provisioning the Kubernetes cluster, setting up the Elastic File System (EFS), integrate EKS with other aws services like ELB, EFS and EBS. After doing Integration we can launch a pod that will be Wordpress with MySQL database

Follow These steps to Integrate the EKS to EFS Service and Deploy the wordpress on EKS using mysql.

Step 1:

First we need to create an IAM user with administrator access and configure AWS CLI :

configuration cmd

Step 2:-

To create an EKS cluster from CLI we need to write a YAML file containing all the details :

This cluster configuration file will create nodegroup namely ng-1 and ng-mixed.We also provide the option of SSH login with a .pem key.

To start creating the cluster, execute the eks-cluster.yml file, we use command as:

it will take around 20 minutes to create cluster so wait until the cluster is launched successfully, after this check EKS cluster

it is done you can go and check the CloudFormation to check all the nodegroups

And the EC2 instances to see all the instances are running

The one thing we need to do install amazon-efs-utils in each of the nodes we have created by remote login or through gui. This can be done through the Instances section of AWS EC2 and executing the following command in each node:

Step 3:-

Update config file to allow kubectl to send instructions to master node and you can check nodes through command:

Step 4:-

Create EFS manually and create EFS with same vpc (eks-cluster vpc) and security group( CLuster ShareNode Security Group) used within cluster

give security group (wait till its is available):

Step 5:-

We create an EFS provisioner that allows us to mount EFS storage as PersistentVolumes in kubernetes. It consists of a container that has access to an AWS EFS resource. The container reads a configmap which contains the EFS filesystem ID, the AWS region and the name you want to use for your efs-provisioner. This name will be used later when you create a storage class.

Notice the file system id and the nfs server,Change it according to the EFS created by you. make sure efs created above is available check though gui.

EFS provisioner to be able to mount PVC to EFS or we can can that to create PVC in EFS.

After you are done run the command in CMD:

To see updated config file, we use command:

After the config file is updated, we can create our namespace and set the current (working) namespace. The creation of a namespace is not mandatory; we can work within the current default namespace as well.

Step 6:-

The RBAC is used as a ClusterRoleBinder, where it grants permissions across the entire cluster.

The RBAC is created using a YAML file whose contents are given below.

we can create the RBAC using the following command:

Step 7:-

We create a storage class so that we enable data persistent through EFS. Provision PVC for both MySQL and word press deployments.

The StorageClass is created using the following YAML file:

we can create StorageClass using the following command:

Step 8:-

Create secret box for mysql and wordpress .So some critical information can put inside it like login information.

We create a secret for mysql password using command:

Step 9:-

Now we create a ELB service to allow WordPress to access MySQL DB and deploy MySQL

The mysql file is created using the following YAML file:

create mysql elb using the following command:

Step 10:-

We create a ELB service to allow clients to access WordPress and deploy WordPress.

The wordpress file is created using the following YAML file:

create mysql elb using the following command:

check all the pods are running through command:

Final step :-

Wordpress can mount on MySQL database and store data inside it.After it ,we can access wordpress by LoadBlancer external ip .

To get external ip we use command:


We use the external IP to view the WordPress page.

This is the integration of amazon Elastic Kubernates service with EFS,

you can delete entire cluster with single command:

(delete EFS manually)

similarly wordpress you can use joomla, nextcloud, owncloud and many other application

So that was my first blog ever, about how to deploy wordpress service on AWS EKS Kubernetes. If you have any questions feel free to reach out to me, and thanks for reading if you made it this far!!

For more details visit my GitHub Repository: https://github.com/snehal3099/deploy-wordpress-on-aws-eks.git



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