Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EKS Basic (Terraform)

This repository provisions a basic Amazon EKS cluster and VPC for learning.

Resource names are automatically prefixed using your current AWS identity (derived from your IAM ARN), so different users can apply the same code without name collisions.

What this creates

  • VPC (CIDR 172.31.0.0/16) with public and private subnets
  • Single NAT gateway
  • EKS cluster (1.35) with public endpoint enabled
  • One managed node group (t3.micro, desired size 3)
  • Core EKS addons (coredns, kube-proxy, vpc-cni, eks-pod-identity-agent)

Prerequisites

  • Terraform >= 1.15.0 (recommended)
  • AWS account and IAM permissions to create EKS, EC2, IAM, and VPC resources
  • AWS credentials configured locally (for example via AWS CLI profile/env vars)
  • kubectl and helm (for sample app deployment)

Configure before first apply

  1. Update Terraform backend in backend.tf:
terraform {
  backend "s3" {
    bucket = ""               # Update accordingly
    key    = "<name>.tfstate" # Update accordingly
    region = ""               # Update accordingly
  }
}
  1. If you want to deploy to a different AWS region, update region in provider.tf.

The default region is ap-southeast-1 in provider.tf.

Deploy

terraform init
terraform plan
terraform apply

Connect to the cluster

After apply, configure kubeconfig using the same region that is set in provider.tf (default ap-southeast-1):

aws eks update-kubeconfig \
  --region ap-southeast-1 \
  --name "$(terraform output -raw cluster_name)"

Quick verification:

kubectl get nodes
kubectl get ns

Sample apps

Two sample Helm workloads are included under sample-apps/.

PostgreSQL

cd sample-apps/postgres
bash init.sh

Notes:

  • Uses Bitnami PostgreSQL chart 16.7.21
  • Deployed to namespace postgres
  • Persistence is disabled in values.yaml (data is not durable)
  • Credentials in values.yaml are example/plaintext values; change them before any real usage

WordPress

cd sample-apps/wordpress
bash init.sh

Notes:

  • Uses Bitnami WordPress chart 25.0.5
  • Deployed to namespace wordpress
  • Persistence is disabled for both WordPress and MariaDB in values.yaml

Outputs

  • cluster_name
  • cluster_endpoint (without https://)

Show outputs:

terraform output

Destroy

terraform destroy

If you deployed sample apps, uninstall them first to speed up cleanup:

helm uninstall postgres -n postgres
helm uninstall wordpress -n wordpress

Learning-only warning

This setup is intentionally minimal for learning and experimentation.

  • It is not production hardened.
  • Sample chart values include insecure defaults and no persistent storage.
  • Review and secure IAM, networking, secrets, storage, and ingress settings before any real workload.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages