Create an Amazon EKS Cluster

20 Dec 2023 in TIL

I've been using this Terraform module to deploy test EKS clusters for the longest time, but I just learned that it's even easier when using eksctl.

Create a cluster.yaml file with the following contents. You can change the instanceType and desiredCapacity (the number of nodes) if needed:

yaml
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: mheap-testing
region: eu-west-2
nodeGroups:
- name: ng-1
instanceType: m5.large
desiredCapacity: 1
volumeSize: 80
ssh:
allow: false

Run eksctl create cluster. It takes around 4 minutes:

bash
eksctl create cluster -f cluster.yaml

Update your kubeconfig using the aws CLI:

bash
aws eks --region eu-west-2 update-kubeconfig --name mheap-testing

Now you can run all the kubectl commands that you want.

To delete the cluster when you're done:

bash
eksctl delete cluster -f cluster.yaml