Skip to content


Folders and files

Last commit message
Last commit date

Latest commit



29 Commits

Repository files navigation

Terraform Kubernetes on Amazon Web Services

This repository contains the Terraform module for creating a simple but ready-to-use Kubernetes Cluster on Amazon Web Services Elastic Kubernetes Service (EKS).

It uses the latest available Kubernetes version available in the AWS region and creates a kubeconfig file at completion.

Link to my comprehensive blog post (beginner friendly):

AWS Logo


You need an AWS account.


  • Always uses latest Kubernetes version available at AWS region
  • kubeconfig file generation
  • Authentication via AWS IAM with aws-iam-authenticator (for Linux and macOS)
  • Kubernetes cluster API access is available from workstation IP address only
  • Auto Scaling Group for worker nodes


  • export KUBECONFIG=./kubeconfig_eks in repo root dir to use the generated kubeconfig file
  • Auto Downloads aws-iam-authenticator executable for AWS IAM Kubernetes authorization (Linux & macOS)
  • The enable_amazon variable is used in the hajowieland/terraform-kubernetes-multi-cloud module


See tables at the end for a comprehensive list of inputs and outputs.

  • Default region: eu-central-1 (Frankfurt, Germany)
  • Default node type: t3.medium (2x vCPU, 4.0GB memory)
  • Default node pool size: 2
  • Default Auto Scaling Group minimum: 1
  • Default Auto Scaling Group maximum: 3


terraform apply:


7.44s user
4.09s system
10:39.68 total
7.86s user
4.51s system
10:57.32 total
7.42s user
3.98s system
11:11.69 total

Terraform Inputs

Name Description Type Default Required
enable_amazon Enable / Disable Amazon Web Services k8s bool true yes
random_cluster_suffix Random 6 byte hex suffix for cluster name string true
aws_region AWS region string eu-central-1 yes
aws_profile AWS cli profile string default yes
eks_nodes EKS Kubernetes worker nodes, desired ASG capacity number 2 yes
eks_min_nodes EKS Kubernetes worker nodes, minimal ASG capacity number 1 yes
eks_max_nodes EKS Kubernetes worker nodes, maximal ASG capacity number 3 yes
aws_cidr_block AWS VPC CIDR block string yes
aws_subnets List of 8-bit numbers of subnets base_cidr_block number 2 yes
aws_cluster_name AWS ELS cluster name string k8s-eks yes
aws_instance_type AWS EC2 Instance Type string t3.medium yes


Name Description
kubeconfig_path_aws Kubernetes kubeconfig file
config_map_aws_auth Kubernetes ConfigMap for aws authentication


Terraform module for creating a Kubernetes cluster on Amazon Web Services








No packages published