Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

EKS High-Availability Cluster — Terraform

Production-grade, multi-AZ Amazon EKS cluster built from scratch with Terraform. Designed for high availability: no single point of failure across networking, compute, or control plane access.

Architecture

  • VPC (10.0.0.0/16) spanning 3 Availability Zones (us-east-1a/b/c)
  • 3 public subnets — host NAT gateways and (future) load balancers
  • 3 private subnets — host all EKS worker nodes, no direct internet exposure
  • 3 NAT Gateways, one per AZ — each private subnet routes outbound traffic through its own AZ's NAT gateway. This is a deliberate HA decision: a single shared NAT gateway would mean an AZ outage takes down internet access for all private subnets, not just the affected AZ.
  • EKS control plane with hybrid API access — public endpoint restricted to a single allowed CIDR (operator's IP), private endpoint open within the VPC for node communication
  • EKS Managed Node Group — 3 t3.medium nodes (one lands per AZ given subnet spread), autoscaling between 2–6, rolling updates capped at max_unavailable = 1

IAM Design

Two separate IAM roles, matching AWS's least-privilege model for EKS:

Role Assumed By Purpose
eks-ha-prod-cluster-role eks.amazonaws.com Lets the EKS control plane manage ENIs and AWS resources on your behalf
eks-ha-prod-node-role ec2.amazonaws.com Lets worker nodes join the cluster, manage pod networking (CNI), and pull images from ECR

Remote State

State is stored in S3 with native S3 locking (use_lockfile = true) — no DynamoDB table required.

Prerequisites

  • Terraform >= 1.9.0
  • AWS CLI configured with credentials that have permissions to create VPC/EKS/IAM resources
  • An S3 bucket already created for remote state

Usage

# Copy the example vars file and fill in your values
cp terraform.tfvars.example terraform.tfvars

# Get your public IP for the admin_cidr variable
curl -4 -s ifconfig.me

# Initialize, review, and apply
terraform init
terraform plan
terraform apply

Cost Awareness

This is a portfolio/learning project, not something to leave running. Approximate cost if left up continuously:

  • 3x NAT Gateway: ~$96/mo
  • EKS control plane: ~$73/mo
  • 3x t3.medium nodes: ~$90/mo
  • Total: ~$250-260/mo

Destroy when done with a session:

terraform destroy

Connecting kubectl

aws eks update-kubeconfig --name eks-ha-prod --region us-east-1
kubectl get nodes

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages