DEV Community

Cover image for Multi-Tier Architecture on AWS EKS using Terraform
Rajit Paul
Rajit Paul

Posted on

Multi-Tier Architecture on AWS EKS using Terraform

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!

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (2)

Collapse
 
reddy2018 profile image
parandhama reddy

Nice blog

Collapse
 
rajitpaul profile image
Rajit Paul

Thanks!

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay