๐Ÿ”ฅ Introduction
In cloud-native architectures, Amazon EKS (Elastic Kubernetes Service) is a powerful way to manage containerized applications at scale. When combined with AWS ALB (Application Load Balancer), it ensures seamless traffic management, automatic scaling, and security.

In this guide, I'll walk you through setting up an EKS cluster and deploying an ALB Ingress Controller using Terraform.

๐Ÿ“Œ Why Use ALB with EKS?
Amazon's Application Load Balancer (ALB) integrates well with Kubernetes to:
โœ… Distribute traffic efficiently across multiple pods
โœ… Enable SSL/TLS termination for security
โœ… Support path-based & host-based routing
โœ… Improve scalability with auto-healing features

๐Ÿ› ๏ธ Tech Stack
Terraform โ€“ Infrastructure as Code
AWS EKS โ€“ Kubernetes Cluster
AWS ALB โ€“ Load Balancer
IAM Roles & Policies โ€“ Secure Access
Helm โ€“ Package Manager for Kubernetes

๐Ÿš€ Step 1: Setting Up AWS EKS with Terraform
First, define the EKS cluster in Terraform:

resource "aws_eks_cluster" "eks" {
  name     = "my-eks-cluster"
  role_arn = aws_iam_role.eks_role.arn

  vpc_config {
    subnet_ids = [aws_subnet.public_1.id, aws_subnet.public_2.id]
  }
}

Create IAM Role for the ALB Controller:

resource "aws_iam_role" "alb_controller" {
  name = "alb-controller-role"
  assume_role_policy = jsonencode({
    Statement = [{
      Effect = "Allow"
      Principal = {
        Service = "eks.amazonaws.com"
      }
      Action = "sts:AssumeRole"
    }]
  })
}

๐Ÿš€ Step 2: Deploy ALB Ingress Controller
Once EKS is up and running, install the ALB Ingress Controller using Helm:

helm repo add eks https://aws.github.io/eks-charts
helm install aws-load-balancer-controller eks/aws-load-balancer-controller \
  --set clusterName=my-eks-cluster \
  --set serviceAccount.create=false \
  --set serviceAccount.name=alb-controller \
  -n kube-system

๐Ÿš€ Step 3: Define Ingress Rules
Now, create an Ingress resource to route traffic via ALB:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: my-ingress
  annotations:
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/target-type: ip
spec:
  rules:
  - host: my-app.example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: my-service
            port:
              number: 80

Apply the changes:

kubectl apply -f ingress.yaml

โœ… Verify Deployment
Check if the ALB is created:

kubectl get ingress -A

Head over to AWS Console โ†’ EC2 โ†’ Load Balancers and verify the ALB instance.

๐ŸŽฏ Conclusion
With Terraform and Helm, deploying EKS with ALB is now streamlined and automated. This setup ensures a highly scalable, secure, and manageable cloud-native architecture.

If you found this guide helpful, drop a comment or share your experience! ๐Ÿš€