Vishal Singh
5 min readJul 7, 2020

WebApp with DataBase Connectivity on AWS EKS

AMAZON EKS

Elastic Kubernetes Service:-Amazon Elastic Kubernetes Service (Amazon EKS) is a fully managed Kubernetes service.EKS is the best place to run Kubernetes for several reasons. Fargate removes the need to provision and manage servers, lets you specify and pay for resources per application, and improves security through application isolation by design.EKS is the best place to run Kubernetes for several reasons. First, you can choose to run your EKS clusters using AWS Fargate, which is a serverless compute for containers. Fargate removes the need to provision and manage servers, lets you specify and pay for resources per application, and improves security through application isolation by design. Second, 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. Third, 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.

Benefits:-

  1. High Availability
  2. Serverless option
  3. Secure
  4. Built with the Community

AWS Fargate:-

WS Fargate is a serverless compute engine for containers that work with both Amazon Elastic Container Service (ECS) and Amazon Elastic Kubernetes Service (EKS). Fargate makes it easy for you to focus on building your applications. Fargate removes the need to provision and manage servers, lets you specify and pay for resources per application, and improves security through application isolation by design. Fargate allocates the right amount of computing, eliminating the need to choose instances and scale cluster capacity. You only pay for the resources required to run your containers, so there is no over-provisioning and paying for additional servers.

Elastic Load Balancing:-

Elastic Load Balancing automatically distributes incoming application traffic across multiple targets, such as Amazon EC2 instances, containers, IP addresses, and Lambda functions.

Three Types of Balancer

  1. Application Load Balancer
  2. Network Load Balancer
  3. Classic Load Balancer
ELB

Elastic Block Store:-

Amazon Elastic Block Store (Amazon EBS) provides block-level storage volumes for use with EC2 instances. EBS volumes behave like raw, unformatted block devices. A broad range of workloads, such as relational and non-relational databases, enterprise applications, containerized applications, big data analytics engines, file systems, and media workflows are widely deployed on Amazon EBS.

TYPES OF VOLUME

CloudFormation:-

AWS CloudFormation is a service that gives developers and businesses an easy way to create a collection of related AWS and third-party resources and provision them in an orderly and predictable fashion.

CLOUD FORMATION

AWS EKS CLUSTER

An Amazon EKS cluster consists of two primary components:

  1. The Amazon EKS control plane

2. Amazon EKS worker nodes that are registered with the control plane

WordPress PHP site with MySQL DataBase on AWS EKS

Creating the YAML files, one for WordPress, and another for MySQL.

WORDPRESS-DEPLOYMENT YAML FILE:-

WORDPRESS DEPLOYMENT

MYSQL-DEPLOYMENT YAML FILE:-

MySQL DEPLOYMENT

Kustomization file with an added secret for MySQL

Kustomization file

Create a YAML file for ClusterConfiguration and Fargate for Serverless

Launch AWS EKS using eksctl Command

For the Cluster, Launch run this Command

aws configure 
aws eks update-kubeconfig --name clustername
Create The Cluster using eksctl

Once the AWS EKS Cluster is formed we can deploy our infrastructure

Launch the infrastructure

Zero Downtime Infrastructure Created with ELB

Load Balancer
EBS
Clusters and Cloud Formation

Access the link provided by ELB

Install WordPress & Create a Blog

The zero-downtime feature by deleting our WordPress pod

Delete Pod

Re-deployed without any downtime.

Delete the entire infrastructure, we can run the command

eksctl delete cluster -f clusterfilename.yml
Delete the Cluster