DEV Community

Cover image for Create Amazon EKS Cluster using Terraform Module

Create Amazon EKS Cluster using Terraform Module

Terraform has community supported modules for creating Infrastructure in various Public Cloud Providers.
AWS community has extensively worked on creating useful modules. So if anyone wants to create Infrastructure in AWS they can search for modules in terraform-aws-modules in GitHub to create the Infrastructure.

Amazon EKS Terraform Module

One of the most used services in AWS Cloud is Amazon Elastic Kubernetes Service (Amazon EKS) and we can make use of the Terraform AWS EKS module to create EKS Cluster.

This module comes up with required Infra configuration for and does not need much tweak to create the EKS Cluster.

eks tf module

How to create Cluster

Using this module we can start the EKS Cluster creation in just 3 steps.
For example: Here are the simple steps to create EKS Cluster with self managed nodes

  • Step 1: Clone the Terraform EKS repo from here
  • Step 2: Go to examples/self_managed_node_group
  • Step 3: Run below terraform commands to create EKS Cluster in AWS Cloud
terraform init
terraform plan
terraform apply
Enter fullscreen mode Exit fullscreen mode

Follow the similar steps to create EKS Cluster of type EKS managed node group. The example code available in the directory examples/eks_managed_node_group

Start using the Cluster

Once the terraform apply is completed successfully, it will show a set of terraform output values containing the details of the newly created cluster.

Run the below command to update the users kubeconfig file to start using the cluster

aws eks update-kubeconfig --name ex-self-managed-node-group
Enter fullscreen mode Exit fullscreen mode

This command will update the details Cluster context and user sections in ~/.kube/config file.

In the next blog, we will see how to start using the Cluster and what are all the components created as part of Amazon EKS Cluster Terraform Code.

Things to note

User needs to have,

Top comments (0)