Skip to content

ohanyere/aws-platform-infra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Terraform AWS EKS Infrastructure

This project provisions a production-style Kubernetes infrastructure on AWS using Terraform.

🧱 What This Project Creates

Networking (VPC Module)

  • Custom VPC
  • Public and Private Subnets (multi-AZ)
  • Internet Gateway
  • Single NAT Gateway (cost-optimized)
  • Route Tables and Associations

Kubernetes (EKS Module)

  • Amazon EKS Cluster (control plane)
  • Managed Node Groups (EC2 worker nodes)
  • IAM Roles for cluster and nodes

🏗️ Architecture Overview

Internet
   ↓
AWS Load Balancer
   ↓
Kubernetes Service
   ↓
Pods (containers)
   ↓
Worker Nodes (EC2)
   ↓
Private Subnets
   ↓
VPC

Control Plane (managed by AWS EKS):

  • Schedules pods
  • Manages cluster state

Worker Nodes:

  • Run application workloads

📂 Project Structure

eks/
├── bootstrap/              # (optional) backend setup
├── infra/
│   ├── main.tf            # Root module
│   ├── variables.tf
│   ├── outputs.tf
│   ├── providers.tf
│   ├── terraform.tfvars
│   └── modules/
│       ├── vpc/           # VPC module
│       └── eks/           # EKS module
├── .gitignore
└── README.md

⚙️ Prerequisites

  • Terraform >= 1.5

  • AWS CLI configured

  • kubectl installed

  • AWS account with permissions for:

    • VPC
    • EKS
    • IAM
    • EC2

🚀 How to Deploy

1. Navigate to infra

cd infra

2. Initialize Terraform

terraform init

3. Validate configuration

terraform validate

4. Preview changes

terraform plan

5. Apply infrastructure

terraform apply

🔗 Connect to EKS Cluster

After successful apply:

aws eks update-kubeconfig \
  --region us-east-1 \
  --name <your-cluster-name>

Verify:

kubectl get nodes

💰 Cost Optimization

This project uses:

  • 1 NAT Gateway (instead of 3) to reduce cost

⚠️ Note:

  • NAT Gateways are billed hourly + per GB
  • EKS control plane is billed hourly
  • Always destroy resources when not in use

🧹 Destroy Infrastructure

terraform destroy

🔐 Security Notes

  • Do NOT commit:

    • .terraform/
    • .tfstate
    • .tfvars (if it contains secrets)
    • .pem files

🧠 Learning Objectives

This project demonstrates:

  • Terraform modular architecture
  • AWS VPC design (public/private subnets)
  • EKS cluster provisioning
  • Kubernetes networking (Service, LoadBalancer)
  • Infrastructure-as-Code best practices

📌 Future Improvements

  • Add remote backend (S3 + DynamoDB)
  • Add IRSA (IAM Roles for Service Accounts)
  • Add Ingress Controller (NGINX / ALB)
  • Add CI/CD (GitHub Actions)
  • Add monitoring (Prometheus + Grafana)

👤 Author : Ohanyere

Built as part of DevOps / Platform Engineering learning journey.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages