DEV Community

loading...
Cover image for Multi-Tier Architecture on AWS EKS using Terraform

Multi-Tier Architecture on AWS EKS using Terraform

Rajit Paul
Experienced in working with different technologies and integrating them to find the optimal solution for a challenge. AWS | DevOps | ML | DL | Mobile-Dev
・2 min read

About AWS EKS:

Amazon Elastic Kubernetes Service (Amazon EKS) gives you the flexibility to start, run, and scale Kubernetes applications in the AWS cloud or on-premises. Amazon EKS helps you provide highly-available and secure clusters and automates key tasks such as patching, node provisioning, and updates. Customers such as Intel, Snap, Intuit, GoDaddy, and Autodesk trust EKS to run their most sensitive and mission critical applications.
[source: aws.amazon.com]

Create an IAM user and run aws configure

https://www.youtube.com/watch?v=wRzzBb18qUw
https://www.youtube.com/watch?v=EAqK404sOI4

Creating an AWS EKS Cluster using Terraform

TF Script - https://github.com/RajitPaul11/terraform_aws/blob/main/AWS_EKS_RDS/main.tf

  1. terraform init
  2. terraform validate
  3. terraform plan
  4. terraform apply --auto-approve

Alt Text

Creating NodeGroup IAM Role

TF Script - https://github.com/RajitPaul11/terraform_aws/blob/main/AWS_EKS_RDS/ng_iam_role.tf

  1. terraform validate
  2. terraform plan
  3. terraform apply --auto-approve

Creating Nodegroup in EKS Cluster

TF Script -
https://github.com/RajitPaul11/terraform_aws/blob/main/AWS_EKS_RDS/eks_ng.tf

  1. terraform validate
  2. terraform plan
  3. terraform apply --auto-approve

Creating an RDS DB Instance

TF Script -
https://github.com/RajitPaul11/terraform_aws/blob/main/AWS_EKS_RDS/rds.tf

  1. terraform validate
  2. terraform plan
  3. terraform apply --auto-approve

Now we need to update kubeconfig and connect locally installed eksctl to AWS EKS Cluster

Alt Text
aws eks update-kubeconfig --name EKS-TF --region ap-south-1
eksctl utils write-kubeconfig --cluster=EKS-TF

Setting up the Wordpress-Deployment.yaml with necessary MySQL attributes

https://github.com/RajitPaul11/terraform_aws/blob/main/AWS_EKS_RDS/wordpress-deployment.yaml

Deploying Wordpress on the EKS Cluster

TF Script -
https://github.com/RajitPaul11/terraform_aws/blob/main/AWS_EKS_RDS/null_res_wp.tf

  1. terraform init
  2. terraform validate
  3. terraform plan
  4. terraform apply --auto-approve

Alt Text

Github - https://github.com/RajitPaul11/terraform_aws/tree/main/AWS_EKS_RDS

Thanks for reading, see you on the next blog!

Discussion (2)

Collapse
reddy2018 profile image
parandhama reddy

Nice blog

Collapse
rajitpaul profile image
Rajit Paul Author

Thanks!